Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Add hatchcolor parameter for Collections#29044
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes from1 commit
d7da1fc
2fd17a0
f5978ce
5377127
6f18c49
8a7cd65
e3b03fc
7668535
9d0ec23
7e46707
c5e9583
d2b6268
fee895b
b9ac0fb
2e4784b
3b43bc6
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -431,29 +431,51 @@ | ||
self._antialiaseds, self._urls, | ||
"screen", self.get_hatchcolor() | ||
) | ||
except TypeError: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. This seems to me like a pretty brittle way of checking if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. As explained by anntzer in thiscomment,
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. It's worth explicitly documenting this in the comment, see suggestion above. | ||
hatchcolors_arg_supported = False | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. These lines are run only in the case of a third-party backend. However, I am not sure how to test this within the current testing framework of matplotlib, without a third-party backend. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. You can make a mock third party backend to call the function - there are some examples of other mocks in the tests | ||
if self._gapcolor is not None: | ||
# First draw paths within the gaps. | ||
ipaths, ilinestyles = self._get_inverse_paths_linestyles() | ||
args = [offsets, offset_trf, [mcolors.to_rgba("none")], self._gapcolor, | ||
self._linewidths, ilinestyles, self._antialiaseds, self._urls, | ||
"screen", self.get_hatchcolor()] | ||
if hatchcolors_arg_supported: | ||
renderer.draw_path_collection(gc, transform.frozen(), ipaths, | ||
self.get_transforms(), *args) | ||
else: | ||
# If the renderer does not support the hatchcolors argument, | ||
# iterate over the paths and draw them one by one. | ||
path_ids = renderer._iter_collection_raw_paths( | ||
transform.frozen(), ipaths, self.get_transforms()) | ||
for xo, yo, path_id, gc0, rgbFace in renderer._iter_collection( | ||
gc, list(path_ids), *args | ||
): | ||
path, transform = path_id | ||
if xo != 0 or yo != 0: | ||
transform = transform.frozen() | ||
transform.translate(xo, yo) | ||
renderer.draw_path(gc0, path, transform, rgbFace) | ||
args = [offsets, offset_trf, self.get_facecolor(), self.get_edgecolor(), | ||
self._linewidths, self._linestyles, self._antialiaseds, self._urls, | ||
"screen", self.get_hatchcolor()] | ||
if hatchcolors_arg_supported: | ||
renderer.draw_path_collection(gc, transform.frozen(), paths, | ||
self.get_transforms(), *args) | ||
else: | ||
path_ids = renderer._iter_collection_raw_paths( | ||
transform.frozen(), paths, self.get_transforms()) | ||
for xo, yo, path_id, gc0, rgbFace in renderer._iter_collection( | ||
gc, list(path_ids), *args | ||
): | ||
path, transform = path_id | ||
if xo != 0 or yo != 0: | ||
transform = transform.frozen() | ||
transform.translate(xo, yo) | ||
renderer.draw_path(gc0, path, transform, rgbFace) | ||
gc.restore() | ||
renderer.close_group(self.__class__.__name__) | ||
Uh oh!
There was an error while loading.Please reload this page.