0

I would like to change the ticks intervals on a figure, which looks like that:

enter image description here

I use this:

plt.xticks(np.arange(1945, 2016, 10))

However, what I finally get is:

enter image description here

As you can see, I can't take out the smaller ticks. I tried this line:

ax.tick_params(axis='x', length=0)

But without success, since it show this:

enter image description here

I lost the ticks I would like to plot.

To plot, my code is:

for row, plot in enumerate(toplot):
for col, country in enumerate(countries):
    ax = axes[row][col]
    (dx[(plot, country)]
     .plot(ax=ax, c=color)
     )

Any idea?

JeanS
  • 75
  • 7
  • Maybe you could try to use `ax.tick_params(which='both', axis='x', length=0)`. See the `Axes.tick_params` [documentation](https://matplotlib.org/3.3.4/api/_as_gen/matplotlib.axes.Axes.tick_params.html) for more information. – DeX97 Feb 20 '21 at 09:16
  • Please include your source data and the whole code you use so far. We have no time to "recreate" the source data from your plots. – Valdi_Bo Feb 20 '21 at 09:58

1 Answers1

1

It looks like what you want to do is disable the "minor ticks". Here you can find the official documentation about it, and another thread on stackoverflow about it. I did not try it myself bu just adding ax.minorticks_off() should do the trick !

milembar
  • 919
  • 13
  • 17