-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Feature: stem3D to generate 3D stem plots #15253
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
Conversation
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.
Thanks a lot for the PR! Please check the signature, and if possible add an example for the gallery.
Feel free to ask here if you have any questions.
lib/mpl_toolkits/mplot3d/axes3d.py
Outdated
When plotting 2D data, the direction to use as z ('x', 'y' | ||
or 'z'); defaults to 'z'. | ||
**kwargs | ||
Other arguments are forwarded to matplotlib.axes.Axes.stem |
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.
Please link:
Other arguments are forwarded to matplotlib.axes.Axes.stem | |
Other arguments are forwarded to `matplotlib.axes.Axes.stem`. |
lib/mpl_toolkits/mplot3d/axes3d.py
Outdated
if args and not isinstance(args[1], str): | ||
xs, ys, *args = args | ||
if 'xs' in kwargs: | ||
raise TypeError("""stem() for multiple values for argument |
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.
This can be simplified to
raise TypeError(
"stem() for multiple values for argument 'x'")
lib/mpl_toolkits/mplot3d/axes3d.py
Outdated
@@ -1418,6 +1418,56 @@ def text(self, x, y, z, s, zdir=None, **kwargs): | |||
text3D = text | |||
text2D = Axes.text | |||
|
|||
def stem(self, zs, zdir='z', *args, **kwargs): |
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.
The function should support a call of the form
stem(x, y, z, zdir='y')
That seems not to be possible with the current signature. I think
def stem(x, y, z, *, zdir='z', **kwargs):
should be sufficient. In contrast to 1D, there is no canonical ordering of a sequence of values. However, if you want to fully mimic the MATLAB API, you'd have to use
def stem(*args, zdir='z', **kwargs):
But I would want to see some tests that this more complicated API actually behaves reasonable.
a960814
to
6556e34
Compare
Should I add an example to examples/mplot3d/ showing its usage? |
This commit introduces the stem3D function. It is similar to the stem3 function from Matab. Resolves Issue matplotlib#15066. Signed-off-by: harshanavkis <harshanavkis@gmail.com>
Yes, please. |
6556e34
to
fbb184d
Compare
This commit provides an example on generating 3d stem plots. Resolves Issue matplotlib#15066. Signed-off-by: harshanavkis <harshanavkis@gmail.com>
fbb184d
to
5684348
Compare
There seems to be a problem with projecting the 2d stem to a 3d stem. How can I resolve this? stem() returns a StemContainer object. Is there another *2d_to_3d function? Should I write a new one? |
duplicate: #15264 |
This commit introduces the stem3D function. It is similar to the stem3
function from Matab.
Resolves Issue #15066.
Signed-off-by: harshanavkis harshanavkis@gmail.com
PR Summary
PR Checklist