5

Consider the following code:

using Plots
gr()
x = 1:10
y = rand(10)
plot(x, y)
xaxis!(minorticks=10)

which produces the following plot:

enter image description here

There are 10 minor tick marks on both x- and y-axis. I like to set the number of minor tick marks on only the x-axis, leaving the y-axis with no minor ticks. In the same way, I could ask how I could the number of tick marks on the y-axis independently of x-axis.

I appreciate any help. Thanks.

cbsteh
  • 809
  • 6
  • 19

1 Answers1

3

The xminorticks and yminorticks keywords seem to work, e.g.

using Plots
plot(1:10, xminorticks=10)

Plots.jl plot with x minor ticks only

cbk
  • 4,225
  • 6
  • 27
  • 2
    `xaxis!(xminorticks=10)` also works (though it is redundant). This seems like a bug where `xaxis!` should perhaps have prepended `x` to the option, but doesn't? – Mikael Öhman Jul 24 '21 at 19:18
  • Thanks for this! Are `xminorticks` and `yminorticks` documented? – cbsteh Jul 25 '21 at 04:23
  • They don't seem to be; my usual go-to is the "attributes" section of the Plots.jl documentation, but I don't see these there – cbk Jul 25 '21 at 16:06
  • Yeah, not documented officially. I've checked before posting, but these keywords do get mentioned, albeit very sparsely, on Google, but only when I knew what to search for. – cbsteh Jul 26 '21 at 05:01