I’m struggling a bit getting the right number of minor gridlines for my plots with log/log axes.
These plots are known correlations and have a set range of 1 - 1000 on the y-axis and 0.1 to 10 on the x-axis.
Here is the figure call
p22 = figure(title="SBTn - Jefferies", x_axis_label="Normalized Friction Ratio, Fr",
y_axis_label="Normalized Penetration Resistance, Qtn(1-Bq)+1",
plot_width=std_plot_height, plot_height=std_plot_height, x_axis_type="log", x_range=(0.1, 10),
y_axis_type="log", y_range=(1, 1000))
And here is how I’ve added the gridlines
#p22.xaxis.ticker = [0.1, 1, 10]
#p22.yaxis.ticker = [1, 10, 100, 1000]
p22.outline_line_width = 1.5
p22.outline_line_color = 'black'
p22.xaxis[0].formatter = PrintfTickFormatter(format="%d")
p22.yaxis[0].formatter = PrintfTickFormatter(format="%d")
p22.ygrid.minor_grid_line_color = 'black'
p22.ygrid.minor_grid_line_alpha = 0.1
p22.xgrid.minor_grid_line_color = 'black'
p22.xgrid.minor_grid_line_alpha = 0.1
Here is the result, the y axis works out because it’s ok setting the major ticks to 1, 10, 100 and 1000, the x axis is a bit of a mess because it adds major ticks between 1 and 10. I’m not really sure how to get it to only give the major ticks at each order of magnitude:
I thought that maybe I could use x_minor_ticks to control the number of ticks in between, but that didn’t seem to help.
If it’s not clear, what I want is for the x axis to have major ticks at 0.1, 1 and 10, with minor ticks at 0.2, 0.3… 2, 3…etc. The y axis is fine as is.