Search code examples
pythonmatplotlibaxes

Pyplot set_xscale('log') hides ticks


I have a plot with an Axes, and I call:

axes.set_xscale('log')

After that I cannot see any tick label along the x axis, when I use axes.set_xticks(my_ticks). Without the log I can see the tick labels.

How can I show my ticks on the log scale?


Solution

  • axes.set_xticks(my_ticks) sets the position of the ticks, it normally automatically updates the tick labels, but it seems it doesn't. You can use set_xticklabels() to set them yourself. You can use tick_params() to change properties of the ticks (like length, color etc) themselves.