-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Better deal with Numpy array subclasses in methods other than plot and scatter #5896
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
I agree it will be nice. This particular case will be tricky -- the view limit object is created before and without any knowledge of the input data datatype... |
Perhaps not directly related but this issue was the closest I could find: I'd like
now I have to resort to:
when x is very long I set |
@bjodah I think you are looking for the |
@tacaswell well kind of, but using ymin/ymax: (
(plot shows no vertical lines) then I need to compute ymin, ymax from the maximum/minimum values of all series which will be plotted later, or use a priori information:
(edit: |
Use it in conjunction with a blended transform: http://matplotlib.org/users/transforms_tutorial.html#blended-transformations and go from 0 to 1 in axes space. |
@tacaswell thank you, very neat! For future visitors from e.g. google: import numpy as np; import matplotlib.pyplot as plt;
import matplotlib.transforms as tf
x = np.linspace(-5, 5); y = np.sin(x); ax = plt.subplot(1, 1, 1);
trans = tf.blended_transform_factory(ax.transData, ax.transAxes)
ax.vlines(x, 0, 1, transform=trans); ax.plot(x, y); plt.show() ... and performance is much better! |
that is probably worth an example in the docs. I have seen this question come across multiple times in multiple places. |
|
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help! |
Closing as the original issue was fixed downstream. There are plenty of areas where units support could be improved in similar ways (and the data prototype work plays into that), but this particular report is no longer a problem, I think |
The
plot
andscatter
methods now deal nicely with Numpy array sub-classes, such as Astropy quantities (which have attached units):However, other methods such as
axhline
andaxvline
do not:It would be nice to try and make these methods also support Numpy array sub-classes.
The text was updated successfully, but these errors were encountered: