-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from tacaswell/enh_patch
ENH: add a basic Patch artist
- Loading branch information
Showing
4 changed files
with
152 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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,34 @@ | ||
""" | ||
====== | ||
Circle | ||
====== | ||
Example of directly creating a Patch artist that is defined by a | ||
x, y, and path codes. | ||
""" | ||
|
||
import matplotlib.pyplot as plt | ||
|
||
|
||
from data_prototype.artist import CompatibilityAxes | ||
from data_prototype.patches import Patch | ||
from data_prototype.containers import ArrayContainer | ||
|
||
from matplotlib.path import Path | ||
|
||
c = Path.unit_circle() | ||
|
||
sc = ArrayContainer(None, x=c.vertices[:, 0], y=c.vertices[:, 1], codes=c.codes) | ||
lw2 = Patch(sc, linewidth=3, linestyle=":", edgecolor="C5", alpha=1, hatch=None) | ||
|
||
fig, nax = plt.subplots() | ||
nax.set_aspect("equal") | ||
ax = CompatibilityAxes(nax) | ||
nax.add_artist(ax) | ||
ax.add_artist(lw2, 2) | ||
ax.set_xlim(-1.1, 1.1) | ||
ax.set_ylim(-1.1, 1.1) | ||
|
||
plt.show() |
This file contains 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 |
---|---|---|
|
@@ -18,3 +18,5 @@ exclude = ''' | |
| tests/data | ||
)/ | ||
''' | ||
|
||
[tool.setuptools_scm] |