-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Adding ellipse_arrow.py example and closes #25477 #25779
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
ksunden
merged 34 commits into
matplotlib:main
from
photoniker:add_Ellipse_Arrow_Example
Jun 12, 2023
Merged
Changes from 27 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
eeed6fc
Adding ellipse_arrow.py example and fix #25477
e16c81d
adapt the = lines to fix docu build test
f8dc66f
use plt.subplot()
4ae516e
Now the patches.Ellipse is used for the plot and a marker ">" at the …
0005c7e
changed function docstring to numpy style
944a513
fix flake8 build fail
8acae1e
Update ellipse_arrow.py
photoniker 74c4480
Update ellipse_arrow.py
photoniker 02865ef
Update ellipse_arrow.py
photoniker 15a84c1
Update ellipse_arrow.py
photoniker f9fd868
Update ellipse_arrow.py
photoniker e3ad826
Update ellipse_arrow.py
photoniker e12a72a
Update ellipse_arrow.py
photoniker 303f957
added get_vertices and get_co_vertices methods the Ellipse
3df0bbb
deleted blank lines
bbf76e7
sorry, some more whitespaces in blank line
f074713
added entries in stubs, resolve docu issues
2578cd9
resolve flake8
0b492d1
resolve return values
0386925
Update patches.pyi
photoniker f23854d
overseen some whitespaces, sorry
86fbf90
Merge branch 'add_Ellipse_Arrow_Example' of https://github.com/photon…
135d7cb
soved isort fail. How to solve the subs fail?
9776379
added some more unittest, just in case...
801031f
adapted unittest
3a4ee04
adapted stubs file
46898de
resolve pre-commit codespell
28437f1
Update galleries/examples/shapes_and_collections/ellipse_arrow.py
photoniker 3bbe33f
Some correction :lipstick: ellipse_arrow.py
photoniker 9cbe4ef
added get_vertices_co_vertices.rst to next_whats_new folder
49d89d1
Update patches.py by .. versionadded:: 3.8
photoniker 501436f
get_vertices and get_co_vertices returns now the coordinates of the m…
cf6e95a
Changed get_vertices and get_co_vertices using get_patch_transform().…
896a775
fix in unittest due to different ordering of vertices return values
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
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
galleries/examples/shapes_and_collections/ellipse_arrow.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,58 @@ | ||
""" | ||
=================================== | ||
Ellipse with orientation arrow demo | ||
=================================== | ||
|
||
This demo shows how to draw an ellipse with | ||
an orientation arrow (clockwise or counterclockwise). | ||
Compare this to the :doc:`Ellipse collection example | ||
</gallery/shapes_and_collections/ellipse_collection>`. | ||
""" | ||
|
||
import matplotlib.pyplot as plt | ||
|
||
from matplotlib.markers import MarkerStyle | ||
from matplotlib.patches import Ellipse | ||
from matplotlib.transforms import Affine2D | ||
|
||
# Create a figure and axis | ||
fig, ax = plt.subplots(subplot_kw={"aspect": "equal"}) | ||
|
||
# Define an ellipse clockwise | ||
center = (2, 4) | ||
width = 30 | ||
height = 20 | ||
angle = 35 | ||
ellipse = Ellipse( | ||
xy=center, | ||
width=width, | ||
height=height, | ||
angle=angle, | ||
facecolor="none", | ||
edgecolor="b" | ||
) | ||
ax.add_patch(ellipse) | ||
|
||
# Plot a arrow marker at the end point of minor axis | ||
vertices = ellipse.get_co_vertices() | ||
t = Affine2D().rotate_deg(ellipse.angle) | ||
ax.plot( | ||
vertices[0][0], | ||
vertices[0][1], | ||
color="b", | ||
marker=MarkerStyle(">", "full", t), | ||
markersize=10 | ||
) | ||
# Note: To reverse the orientation arrow, switch the marker type from > to <. | ||
|
||
plt.show() | ||
|
||
# %% | ||
# | ||
# .. admonition:: References | ||
# | ||
# The use of the following functions, methods, classes and modules is shown | ||
# in this example: | ||
# | ||
# - `matplotlib.patches` | ||
# - `matplotlib.patches.Ellipse` |
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
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
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
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.