The axis ticks and grid lines are not updated when zooming and panning. Three images are provided to illustrate the issue.
Plots.plot(sin, 0, 2Ï€):

xs=0:0.1:2pi; PyPlot.plot(xs, sin(xs)):
The correct solution to this will be to short-circuit the matplotlib callbacks. I don't have a complete solution, but you can do this like:
using Plots; pyplot()
p = plot(rand(10))
onclick(event) = info("CLICK: $event")
fig = p.o
fig[:canvas][:mpl_connect]("button_press_event", onclick)
The idea would be to update the plot limits inside p and re-display the Plots.Plot object. The only trickiness is that we don't want to get in an infinite loop of re-drawing. Ideally we can just turn off the matplotlib gui events and update the plot ourselves.
some references:
https://github.com/matplotlib/matplotlib/blob/f3ed922d935751e08494e5fb5311d3050a3b637b/lib/matplotlib/backend_tools.py
http://matplotlib.org/users/event_handling.html
https://github.com/matplotlib/matplotlib/blob/6b1adfd64071df3eae076398b791ce51ac1ca603/lib/matplotlib/backends/backend_qt5.py#L686
http://matplotlib.1069221.n5.nabble.com/Auto-wrapping-text-within-a-plot-Is-there-a-simpler-solution-td20.html
https://gist.github.com/tacaswell/3144287
I see this behaviour with several backends (PyPlot, GR, and PlotlyJS). It is a bit of an inconvenience during data exploration.
perhaps if there was a ticks=:backend option or something that just bypasses Plots tick handling and lets the backend handle tick placement?
Yeah that could be a good solution
On Wednesday, October 5, 2016, Spencer Russell [email protected]
wrote:
perhaps if there was a ticks=:backend option or something that just
bypasses Plots tick handling and lets the backend handle tick placement?—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/tbreloff/Plots.jl/issues/394#issuecomment-251811392,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA492pdnBQ_8WsJOTprf-GjRisdCBFUWks5qxB0VgaJpZM4JQ0Jd
.
Being bitten by this right now. So sad it received no attention for over 2 years...
Use ticks = :native
Is it possible to extract the current zoom state? I'm not very experienced with recipes, but I'm trying to plot some mass spectrometry data. Conceptually, the data are stored as a sparse matrix with ~1000 columns but ~10^6 rows. The idea is that for a particular zoom state, I want to aggregate the rows within the zoom region into ~1000 "superrows". It would be something like
ylims = get_ylims()
xlims = get_xlims()
buffer = AxisArray(Matrix{T}(undef, 1000, 1000), Axis{:yname}(ylims), Axis{:xname}(xlims))
copyto!(buffer, masspecdata) # this sums into "superrows", using just the part of masspecdata that is within the limits
imshow(buffer)
Is it possible to extract the current zoom state?
Not through Plots directly, however, you can access matplotlib objects from a plot and use matplotlib functions:
julia> using Plots; pyplot()
Plots.PyPlotBackend()
julia> p = plot(1:5) # make a plot
julia> sp = p[1] # select the 1st subplot
Subplot{1}
julia> pyaxis = sp.o # get the matplotlib axis object
PyObject <matplotlib.axes._axes.Axes object at 0x7f5100fc1690>
julia> ylims = pyaxis.get_ylim() # use matplotlib's get_ylim
(0.88, 5.12)
or in one line:
julia> p[1].o.get_ylim()
(0.88, 5.12)
After zooming interactively:
julia> p[1].o.get_ylim()
(2.5431878445728913, 4.622146084043291)
Most helpful comment
Use
ticks = :native