0

I have a log-log contour plot for which I needed to display the minor ticks. So I used

ax.xaxis.set_minor_formatter(fmt("%.1f"))
ax.yaxis.set_minor_formatter(fmt("%.1f"))

where fmt is from matplotlib.ticker import FormatStrFormatter as fmt

This works fine and gives me all the minor ticks. However as you can see from the attached image, the x-axis ticks, especially 7.0,8.0 and 9.0 are the ticks that overlap, and I want to specifically remove only them, but have the other minor ticks as they are.

Is this possible? I am not able to find a code that removes specific minor ticks.

enter image description here

Srivatsan
  • 9,225
  • 13
  • 58
  • 83
  • @:Check this answer http://stackoverflow.com/questions/13576805/matplotlib-hiding-specific-ticks-on-x-axis – George Mar 31 '15 at 13:24
  • @George I actually found a much easier solution [HERE](http://stackoverflow.com/questions/6567724/matplotlib-so-log-axis-only-has-minor-tick-mark-labels-at-specified-points-also) immediately after I posted the question. – Srivatsan Mar 31 '15 at 13:27

1 Answers1

1

Immediately after posting the question, I found an easy solution.

It is to use ax.xaxis.set_minor_locator(plt.FixedLocator([2,3,4,5]))

The list inside the FixedLocator does the job.

Srivatsan
  • 9,225
  • 13
  • 58
  • 83