-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add 3D stem plot #18310
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
Add 3D stem plot #18310
Conversation
On further thought, I think If we want to keep |
After discussing with @tacaswell, I changed this to use |
3397aa6
to
cc16195
Compare
I am 👍 in general, my primary concern is only being able to control the style via the plot-style format strings. I think that this is OK to start with, but long term we may want to expose all of the knobs. |
However, this matches the 2D stem (https://matplotlib.org/api/_as_gen/matplotlib.pyplot.stem.html) and you can always change the styling after the fact. |
* Implemented 3D stem plots. * refactor code to work with juggle_axes() * Fixed pep8 * Changed file names * update code, tests, and demos to work with zdir param and stem() * fix pep8 for test file * clean up baseline images Co-authored-by: Jessy Liang <jessy.liang@mail.utoronto.ca> Co-authored-by: Samriddhi Kaushik <samriddhi.kaushik@mail.utoronto.ca>
There's no backwards compatibility to worry about, so we don't need to accept arbitrary positional arguments.
We can stop adding multiple lines and put in a single `plot`, which also ensures that everything gets the same properties.
This is hopefully a less confusing way to define the 3D stem plot in different directions, as the x/y/z always mean the same point, while only the stem direction changes.
These are somewhat like the original tests in matplotlib#6271, but consolidated into a single image, and testing more properties.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ready to go.
PR Summary
This is a rebase and squash of #6271. Because the 3D projection changed since that was written, I had to throw away the original test images to prevent bloat, but I took that opportunity to drop some duplicates and use the mpl20 style. I then modernized docs to match current standards, and simplified some bits.
As this is completely new, I chose to avoid the optional things in the 2D
stem
, i.e., it does not attempt to guess coordinates for the baseline. It also always returns aLine3DCollection
forstemlines
.I'm not entirely sure I like the way
zdir
works. It usesjuggle_axes
, so it does like other 2D-converted things and rotates what x/y/z mean. This makes sense for an artist that's a 2D plane, but this is 3D. On the other hand,Line3D
works the same way. Perhaps the direction of stem lines/baseline should not be tied tozdir
, but useorientation
like in 2D?I will write What's new when we decide what the right API is here.
Closes #6271.
PR Checklist