Formatting Engineering Units on Matplotlib Axis Labels
·1 min
Do you struggle with units in your axis labels? So did I…
Sometimes I found myself multiplying the values in my data just to rely on matplotlib to render the right scientific notation. Instead of changing your data, just format the plot using a Formatter object.
My favorite is the EngFormatter which will format the labels in engineering notation to represent powers of 1000.
Below is a quick example on displaying oil cumulatives, which are usually rendered in thousands or millions.