0

I'm plotting over a small range, but I'm using a log-log plot to make certain features more clear. How can I set ticks on the x-axis that aren't powers of any base, but multiples of some value?

Basically, I want labels on the x-axis at the values [x * 1E13 for x in range(1,10)].

Dan
  • 12,157
  • 12
  • 50
  • 84
  • Is the plot meant for interactive use? In other words; does the mouse-over values in an interactive plot have to be precise? This makes a difference as to how to format the ticklabels on the x-axis. Also, please include your code! – sodd May 31 '13 at 13:45

1 Answers1

1

You can use a FixedLocator and call set_major_locator on your x axis with it.

my_xaxis.set_major_locator(FixedLocator([x * 1E13 for x in range(1,10)]))

If you want labels, you need to set them manually:

labels = FixedFormatter(['{:5.2e}'.format(x * 1E13) for x in range(1,10)])
my_xaxis.set_major_formatter(labels)
Mike Müller
  • 82,630
  • 20
  • 166
  • 161