connorferster / forallpeople

Python SI units library: your 'daily driver' for calculations.
Apache License 2.0
295 stars 39 forks source link

matplotlib compatibility #65

Open ddi-acassidy opened 2 years ago

ddi-acassidy commented 2 years ago

Ive noticed that the auto-prefixing functionality means the prefix is ignored when plotting with matplotlib, for example if I have a value going from 1 Hz to 10kHz, it will "reset" at 1kHz since matplotlib is plotting it as a 1, not as 1000. as I result I have to remove all units before I can plot data.

It seems like .value works correctly with autoprefixes, so im not sure where the incompatibility lies

ddi-acassidy commented 2 years ago

Looks like this is due to the casting behavior

spam = 2000 * si.Hz
float(spam) # = 2.0

I dont think this behavior makes sense