3

I have a plot that accepts data with huge differences in scale. To keep the axes clean I am forcing scientific notation so digits don't run off the figure. To do this, I am using ScalarFormatter and adjusting the ticklabel_format like so:

ax.yaxis.set_major_formatter(ScalarFormatter(useMathText=True, useOffset=False))
ax.ticklabel_format(style='sci', scilimits=(0,0), axis='both')

The scientific notation is plotted exactly how I want with the exception that too many decimals points can sometimes be displayed. The y-axis tick labels are getting clipped

I found a similar question here: Show decimal places and scientific notation on the axis of a matplotlib plot

But I don't want the exponential factor showing on every label like in the accepted solution. Also, the FormatStrFormatter overwrites my previous ScalarFormatter settings so I think only 1 Formatter can be used.

I would like a plot that always looks like this: Where the tick labels always limit to 1 decimal

Marshall
  • 33
  • 4

0 Answers0