Ticks and grid for x in Plots.jl


Is there a way to delete the vertical grid without deleting the ticks on x?


I think you can only delete all of the grid, using grid = false.

@mkborregaard: I think you can only delete all of the grid, using grid = false.

Though that might be the intent of Plots.jl, some backends might not respond this way. For example, I know the grid keyword will only affect the grid (cannot control tick marks) on InspectDR. (This limitation might end up being a feature in your case).

For other backends, I suppose you could define your own function (ex: ticks):

import MyPlotsWrapperModule: ticks


p = plot(x, x)
pp = display(p) #Get ref to PyPlot "figure"

#Use type from Plots.backend() to dispatch implementation of ticks:
ticks(backend(), xmajor=true, xminor=true, yminor=false)

#Or maybe you could instead dispatch from the PyPlot figure type directly:
ticks(pp, xmajor=true, xminor=true, yminor=false)

(Because I would not be surprised if PyPlot backend had control over ticks.)

I guess this is not an ideal solution - but it might be faster than waiting for Plots.jl to support this feature.

Sorry for being unclear. grid = false does not delete tickmarks. What I meant was, you cannot just remove the vertical gridlines - the horizontal ones will disappear as well.


Contributions welcome!

1 Like