Changing number of x ticks in plot

Hello

I’m trying to plot some seismograms and would like to be able to change the number of ticks (labels) on the x axis. When I try to change this using the ‘number_of_ticks’ argument it doesn’t result in any change to the output figure

For example:

st[0].plot(starttime=UTCphase-50, endtime=UTCphase2+100, linewidth=0.5, tick_rotation=0, number_of_ticks=3)

and

st[0].plot(starttime=UTCphase-50, endtime=UTCphase2+100, linewidth=0.5, tick_rotation=0, number_of_ticks=10)

Both result in figures that look the same (sorry it doesn’t seem to want to attach) with 5 ticks on the x axis.

I’ve had a look in obspy.imaging.waveforms and it I note that it does say Unused variable for the function:

__plot_set_x_ticks(self, *args, **kwargs): # @UnusedVariable

Is there another way to change the number of ticks on the x axis or should I try matplotlib/gmt in this instance?

Thanks!

Amy

I had a look in the code and that parameter is actually exclusively used in the dayplot option of plotting, but it is described in the general parameters section. So docs and code do not line up well.

For mid term I will move it in the docs. For the long term somebody could implement that parameter in the general waveform wiggle plot as well.

For the short term if you need to change ticks, you might have to do it yourself. Either set up the plot in matplotlib from scratch, or you could use show=False and handle=True and do final touches to your figure before showing it (see https://matplotlib.org/3.3.2/api/ticker_api.html).