0

I'm graphing a large number of plots whose data vary substantially. The values are in scientific notation ranging from E-9 to E+3 for a particular unit and I need to adjust that in the axis label as well as in the data.

For example, if I have a data range that's on the order of E-6, is there a module or function that can automatically change the data and the units from 0.000001 m (meters) to 1.0 um (micrometers)?

Note: all of the data is in the form X.XXXXXXE+X, if that matters, but I can turn it into floats if necessary.

adamcircle
  • 694
  • 1
  • 10
  • 26
  • Try pint: https://pint.readthedocs.io/en/0.7.2/ – rwhitt2049 Jun 12 '17 at 19:53
  • You can define a function that calculates and plots the numbers that correspond to the desired unit; just specify the unit as an input in the function. –  Jun 13 '17 at 08:39

1 Answers1

0

Not sure why a special package or function would be required to change from meters to micrometers. This is a simple multiplication by 1e6.

If your data in meters is data_meters, you get the data in micrometers data_mu by

data_mu = data_meters * 1.e6
ImportanceOfBeingErnest
  • 321,279
  • 53
  • 665
  • 712