0

I want plot a bar plot using the following code

num_trade.plot.bar()

where num_trade is a pandas.Series object. This is the result

enter image description here

the xtick labels are crowded, how can make it more sparse to make the labels more visible?

William Miller
  • 9,839
  • 3
  • 25
  • 46
yogazining
  • 119
  • 2
  • 10
  • 1
    This [post](https://stackoverflow.com/questions/30133280/pandas-bar-plot-changes-date-format) might be helpful. – JohanC Apr 07 '20 at 09:33

1 Answers1

1

Assuming that the x-axis is time series data, an easy way to achieve this is to use the following settings, which will take care of it automatically

locator = mdates.AutoDateLocator()
formatter = mdates.ConciseDateFormatter(locator)

ax.xaxis.set_major_locator(locator)
ax.xaxis.set_major_formatter(formatter)
r-beginners
  • 31,170
  • 3
  • 14
  • 32