2

I am plotting pretty straightforward bar graphs where the x values are large numbers. Matplotlib seems to handle this by using the last 2-3 numbers in the value on the plot and then in a 'legend' put the first x numbers. So in the example I am showing the first tick is representative of the number 8245540, 40 is used on the plot and 82455 is put in the legend.

Is there a way to control the way the numbers are abbreviated or simply use the full number when labeling the x axis?

Below is an example.

enter image description here

The Nightman
  • 5,609
  • 13
  • 41
  • 74

1 Answers1

2

Use the following:

from matplotlib.ticker import FormatStrFormatter
# plot here
pyplot.gca().xaxis.set_major_formatter(FormatStrFormatter('%d'))

See this for more details: Matplotlib: Specify format of floats for tick lables

Gerges
  • 6,269
  • 2
  • 22
  • 44