Y-tick placement on log scale

Hello,

I’m hoping to get some advice on controlling y-tick placement on a log-log plot. I’m try to make the axis ticks on a plot bigger, and I’m running into this issue:

Considering that I need to make the font that size, I want to tell the left plot not to place so many ticks that the numbers overlap. But I’m having some trouble doing that with the yticks=... argument in Plots.jl.

Can anybody help me? Here is a MWE-type example of the code that makes these figures (using only the data from the red lines in the above plots), with the exact code that made them located here. The MWE example doesn’t show exactly the same issue, but even with a little playing around I can make the y-tick placement behave pretty irregularly. It would be nice if I could find a way to make it put ticks at every power and half-power of ten, or something.

I have to use PlotlyJS, and if it is relevant I’m making these plots on a Fedora linux box, with Plots.jl version 0.26.0, PlotlyJS version 0.12.5.

using Plots
plotlyjs()

X = [1.0,2.0,3.0,4.0,5.0,10.0,20.0,30.0,50.0,100.0]
Y = [3.74951130034201e-9,3.0015593753166335e-9,1.993477449008477e-9,2.1056410677307034e-9,2.1116576643500775e-9,1.2943044303709163e-9,1.2441630841653538e-9,7.370279048528063e-10,6.705537380896856e-10,4.3901063848787426e-10]
Z = [0.2907033044503297,0.1769673209676217,0.16545431406655836,0.10663529522976559,0.11626557444231143,0.09452702029920076,0.05620186644219592,0.04992161525344989,0.0414831389006808,0.025665676468083744]

Y_ticks = [5.0e-9, 1.0e-9, 5.0e-10, 1.0e-10]
Z_ticks = [0.5, 0.1, 0.05, 0.01]

pt1 = plot(X, Y, yaxis=:log10, xaxis=:log10, tickfont=font(12), leg=false, 
           grid=false, yticks=Y_ticks)

pt2 = plot(X, Z, yaxis=:log10, xaxis=:log10, tickfont=font(12), leg=false, 
           grid=false, yticks=Z_ticks)


Thank you for very much for reading!

1 Like