0

Trying to include the thousand separator to the X-axis ticks of the following histogram.

plt.hist(df.Sales_Forecast,bins=20)
plt.xticks(list(range(0,50000,2000)),fontsize=14)
pppery
  • 3,731
  • 22
  • 33
  • 46
Paolo
  • 1
  • 1
    Does this answer your question? [Formatting y-axis matplotlib with thousands separator and font size](https://stackoverflow.com/questions/51734218/formatting-y-axis-matplotlib-with-thousands-separator-and-font-size) – jayveesea Jun 04 '20 at 21:22
  • Hi, thank you for replying... Well I get this error message: "module 'matplotlib.pyplot' has no attribute 'ticker'" Even if I imported matplotlib.... – Paolo Jun 15 '20 at 21:01
  • you need something like `import matplotlib.ticker as ticker` and then when the time comes something like `ax.get_xaxis().set_major_formatter(ticker.FuncFormatter(lambda x, p: format(int(x), ',')))` – jayveesea Jun 16 '20 at 18:23

0 Answers0