Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
[WIP] Add the ability for unit converters to convert back to data with units#12270
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
jklymak commentedSep 25, 2018
Many of the converters convert from different units to matplotlib values. I.e. the date converters. So how will you invert if the inversion is non-unique? As pointed out a few times, I think any co-ordinate that gets unitized should go ahead and be converted, but we should pack the original in w/ the conversion. Then we can always get back to where we started. I.e. |
dstansby commentedSep 25, 2018
Can you give an example of the different date units? The way I've set it up, doing how the back-conversion is done is entirely up to the implementation of the Although that is potentially a good idea, it doesn't cover cases where the conversion back is not being done on a data point, e.g. |
3e22cfc to78dda48Comparejklymak commentedSep 25, 2018
The date converter will accept More to the point, if we change the units of the axis, inverting and then re-converting is not garaunteed to be correct if we don't get the original data. I'm not sure I follow the xlim/ylim issue. I don't see any reason xlim/ylim can't be wrapped in the same way as other data. |
dstansby commentedSep 25, 2018
That makes sense; we can just make different copies of each |
e50d728 to79acf30Compareec80e48 to15ddfa9Comparedstansby commentedOct 4, 2018
Still needs:
|
61c05d2 to67bde14Compare22f7fed to5449bcdCompare54c996e to3e837ddCompare985b499 to35a73a2Comparejklymak commentedSep 27, 2019
@dstansby, I think this should be discussed more before more work is done. As I understand it, the plan for 4.0 is to have a new way of carrying the data around inside Matplotlib. That may be a pipe dream, in which case something like this may be a good half measure, but we should make sure this fits in the roadmap?@dopplershift@tacaswell were particularly interested in better units support. |
dstansby commentedSep 29, 2019
Thanks for pointing that out - is there a roadmap for 4.0 or anything written down anywhere about the changes to data-carrying? Either way I'm kind of happy to carry on playing with this and writing it up on a zero-merge-expectation basis. |
jklymak commentedSep 29, 2019
That seems reasonable. There is a paper document.https://paper.dropbox.com/doc/Matplotlib-4.0-WTYwd0NQaSHTjtLUZwkNx |
dstansby commentedJul 28, 2020
I think there's another version of this kicking around somewhere, and it's clear that something like this needs some more careful thought and design, so I'm going to close this. |
Uh oh!
There was an error while loading.Please reload this page.
Inspired by#7462, and not-so-recent units discussions on the mailing list, I have made a minimal implementation of having an
un_convertmethod forConversionInterfaceclasses. The benifit of this is that Matplotlib can re-convert from "axis coordinates" to "data/unit coordinates", and return data with units. This is particularly useful for things likeginput.I will write this up more in the future, but for to keep a paper trail this is a pre-requisite for a
accepts_unitsdecorator (see#10411 for an attempt at this) that would automatically catch issues such as#15332 ,