You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Often the data stored in images can have physical values associated with them. It would therefore be good if there was support for using the unit machinery to allow images to have units.
Proposed Solution
Here's a short example that should work fine using units, but which currently fails. The use of datetime is a bit contrived, but I chose it to avoid a third party package. For a more realistic real-world example see astropy/astropy#11306.
File"/Users/dstansby/github/matplotlib/lib/matplotlib/axes/_axes.py", line5586, inimshowim.set_data(X)
File"/Users/dstansby/github/matplotlib/lib/matplotlib/image.py", line700, inset_dataraiseTypeError("Image data of dtype {} cannot be converted to "TypeError: Imagedataofdtypeobjectcannotbeconvertedtofloat
Re-engineering data handling to make this possible in general is the goal of the Chan-Zuckerberg proposal that just was renewed. I'm not sure if something practical like this should be done in the more immediate term. Adding a converter to everything that could use a converter is possible, but will likely end up causing some pain at somepoitn without some proper engineering. ie. suppose I want to change the z-data of the image in an animation?
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!
Activity
jklymak commentedon Feb 8, 2021
Crossref #7383 and #11422 where this is discussed....
jklymak commentedon Feb 8, 2021
Re-engineering data handling to make this possible in general is the goal of the Chan-Zuckerberg proposal that just was renewed. I'm not sure if something practical like this should be done in the more immediate term. Adding a converter to everything that could use a converter is possible, but will likely end up causing some pain at somepoitn without some proper engineering. ie. suppose I want to change the z-data of the image in an animation?
dstansby commentedon Feb 8, 2021
Ah apologies, I didn't find #7383 in my searches before opening this issue. Happy to close this and divert discussion there.
jklymak commentedon Feb 8, 2021
Well that discussion was just for categorical, so pointing out that it is more general is useful.
github-actions commentedon Oct 6, 2023
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!