Automatic adjustment of ticks when zooming with Plots.jl

I had forgotten about this post. That’s great to hear @dalarev!

FYI: How to get it to work with PyPlot

Apparently, this behaviour can be achieved with PyPlot if you set options:

pyplot(ticks=:native)

or if you set the option in your plot command:

plot(x, y, [other args here], ticks=:native)

I checked with the maintainers of Plots.jl, and it appears the intent of ticks=:native is indeed to use PyPlot’s own internal programming to display ticks (which auto-adjusts as you zoom):
[FR] Use ticks=:native by default? · Issue #3263 · JuliaPlots/Plots.jl · GitHub

PyPlot bug warning

Having said that, there still appears to be a bug with how Plots.jl controls the PyPlot backend. Specifically, it has issues displaying tick labels when ticks=:native, for some reason:
pyplot(ticks=:native) doesn't use native ticks · Issue #3284 · JuliaPlots/Plots.jl · GitHub

2 Likes