I have a figure with a log axis
and I would like to relabel the axis ticks with logs of the values, rather than the values themselves
The way I've accomplished this is with
plt.axes().set_xticklabels([math.log10(x) for x in plt.axes().get_xticks()])
but I wonder if there isn't a less convoluted way to do this.
What is the correct idiom for systematically relabeling ticks on matplotlib
plots with values computed from the original tick values?
Formatter
, you could just useplt.xticks(x_ticks, x_ticklabels)
to put the pre-definedx_ticklabels
at each corresponding tick of pre-definedx_ticks
. – Danelaw