-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Better document and error handle third dimension in pyplot.text() positional argument #19446
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
Comments
There are 4 required positional arguments, and you passed 3. Thus the last one ( |
In general, Concerning the "missing" argument: since you created a
The message |
IMHO the only thing that could be done, is a note here that
|
Ah OK - I see. That does make sense. I hadn't noticed text3D(self, x, y, z, s, zdir=None, **kwargs). |
We could (not clear whether we should) make the decorator for pyplot functions create a wrapper function that first checks whether gca() is a 3D axes and warns/raises accordingly, even before actually forwarding the parameters. |
Given that From a practical point of view, AFAIK we have not seen other issues on this, so it does not seem a very pressing problem. If there come additional complaints later, we can always add the check then. |
Problem
The documentation for pyplot.text() does not specifically mention how to use in 3d projection plots (it only says two positional arguments are accepted).
matplotlib.pyplot.text(x, y, s, fontdict=None, withdash=<deprecated parameter>, **kwargs)
Additionally, the error thrown if a third dimension is not included is incorrect. For example:
gives the error:
TypeError: text() missing 1 required positional argument: 's'
when, in fact, the error is the missing
z
position argument.Suggested Improvement
The documentation could be improved to show that
z
can (and should) be used in 3d projections. Additionally, the error should be updated to reflect the actual issue (a missing third positional argument).Matplotlib version
The text was updated successfully, but these errors were encountered: