Repository navigation
Separates edgecolor from hatchcolor #28104
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
7b489af
separated hatchcolor from edgecolor in patches
r3kste ed55f09
fixed logic for inherit in collections
r3kste 3155bc0
added a gallery example
r3kste 905ed86
made suggested changes
r3kste 7942afd
reverted use of `inherit`
r3kste 219bb26
fixed the logic for inheriting from edgecolor
r3kste 8e732fa
fixed docs and enhanced tests
r3kste 67a54c3
Apply suggestions from code review
r3kste 84e12fb
made suggested changes
r3kste 5b3a1e6
minor fix
r3kste 8454dfc
use 'edge' instead of 'inherit'
r3kste a3c80e0
fix rcsetup
r3kste 253c7e4
enhanced docs and added note for follow-up PR
r3kste 0754734
Made suggested changes
Impaler343 a74f2af
made suggested changes
r3kste 91ae826
enhanced tests and minor fix in docs
r3kste a23c9c5
minor changes to docs
r3kste 4dd0c2d
Changed wording and alt text
Impaler343 6b54933
Minor Fix
Impaler343 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
added a gallery example
- Loading branch information
commit 3155bc0369e0e22f652f6a67671472417923e2d2
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
galleries/examples/shapes_and_collections/hatchcolor_demo.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| """ | ||
| =========================== | ||
| Using hatchcolor in patches | ||
| =========================== | ||
|
|
||
| This example shows how to use the `hatchcolor` parameter to set the color of | ||
| the hatch. The `hatchcolor` parameter is available for `~.patches.Patch` and | ||
|
Impaler343 marked this conversation as resolved.
Outdated
|
||
| its children. | ||
| """ | ||
|
|
||
| import matplotlib.pyplot as plt | ||
| import numpy as np | ||
|
|
||
| from matplotlib.patches import Rectangle | ||
|
|
||
| fig, (ax1, ax2) = plt.subplots(1, 2) | ||
|
|
||
| # Rectangle with red hatch color and black edge color | ||
| ax1.add_patch(Rectangle((0.1, 0.5), 0.8, 0.3, hatch=".", hatchcolor='red', | ||
| edgecolor='black', lw=2)) | ||
| # If hatchcolor is not passed, the hatch will inherit the edge color | ||
| ax1.add_patch(Rectangle((0.1, 0.1), 0.8, 0.3, hatch='x', edgecolor='orange', lw=2)) | ||
|
|
||
| x = np.arange(1, 5) | ||
| y = np.arange(1, 5) | ||
|
|
||
| ax2.bar(x, y, facecolor='none', edgecolor='red', hatch='//', hatchcolor='blue') | ||
| ax2.set_xlim(0, 5) | ||
| ax2.set_ylim(0, 5) | ||
|
|
||
| plt.show() | ||
|
|
||
| # %% | ||
| # | ||
| # .. admonition:: References | ||
| # | ||
| # The use of the following functions, methods, classes and modules is shown | ||
| # in this example: | ||
| # | ||
| # - `matplotlib.patches` | ||
| # - `matplotlib.patches.Polygon` | ||
| # - `matplotlib.axes.Axes.add_patch` | ||
| # - `matplotlib.axes.Axes.bar` / `matplotlib.pyplot.bar` | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.