0

I am making a log-log plot where the y-axis goes from 0.02 to 0.1. All the tick marks on my y-axes appear as: 2x10^{-2}, 3x10^{-2} ... 0.1. I would like them as 0.02, 0.03 ... 0.1. I have tried a number of things from a relevant post: Matplotlib log scale tick label number formatting. However I could not make it work. I have something like:

 ax.yaxis.set_major_formatter(ticker.FuncFormatter(lambda y, _: '{:g}'.format(y))))

This apparently resolved the issue according to the earlier posts. But does not work for me.

Brato
  • 113
  • 3
  • Please post a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve), this way it is much easier to reproduce your problem and thus help you. – Thomas Kühn Mar 13 '19 at 06:57

1 Answers1

0

I think you should set formatter on both minor and major axis.
Please try this:

 ax.yaxis.set_minor_formatter(ticker.FuncFormatter(lambda y, _: '{:g}'.format(y))))
nmoa
  • 16
  • 3