# Automatic adjustment of ticks when zooming with Plots.jl

**URL:** https://discourse.julialang.org/t/automatic-adjustment-of-ticks-when-zooming-with-plots-jl/5055
**Category:** Visualization
**Tags:** pyplot, plots, plotlyjs, inspectdr
**Created:** [July 25, 2017, 11:37am UTC](https://discourse.julialang.org/t/automatic-adjustment-of-ticks-when-zooming-with-plots-jl/5055 "2017-07-25T11:37:58Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![mzaffalon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mzaffalon/32/214168_2.png) [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)
#### Post date: [July 25, 2017, 11:37am UTC](https://discourse.julialang.org/t/automatic-adjustment-of-ticks-when-zooming-with-plots-jl/5055/1 "2017-07-25T11:37:58Z")

</div>

In `Plots.jl` using `pyplot` as the backend, when I zoom in the plot using the pan/zoom button, the axes ticks are not automatically adjusted as `PyPlot`, nor the x,y coordinates at the bottom left of the plot window are displayed.

Is there a way of obtaining this in `Plots.jl`?

---

<div class="post-metadata">

### Author: ![MA\_Laforge](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ma_laforge/32/385_2.png) [@MA\_Laforge](https://discourse.julialang.org/u/MA_Laforge)
#### Post date: [July 30, 2017, 3:30am UTC](https://discourse.julialang.org/t/automatic-adjustment-of-ticks-when-zooming-with-plots-jl/5055/2 "2017-07-30T03:30:18Z")

</div>

You might want to try out a different backend. Each one has very different underlying behaviours (Plot.jl tries to achieve the similar _outputs_ only).

Choosing a backend: [https://juliaplots.github.io/backends/](https://juliaplots.github.io/backends/)

Of course, I suggest trying the InspectDR.jl backend:

```julia-auto
using Plots
inspectdr() #use InspectDR
#pyplot() #instead of pyplot
plot(1:100,rand(100))

```

- InspectDR was designed with interactivity in mind. For example, you can always box-zoom in on plots by using the right mouse button.
- InspectDR is faster at plotting than PyPlot. It is more noticeable with larger datasets… especially if you draw using only lines (without symbols).

See more on mouse/keybindings: [GitHub - ma-laforge/InspectDR.jl: Fast, interactive Julia/GTK+ plots (+Smith charts +Gtk widget +Cairo-only images)](https://github.com/ma-laforge/InspectDR.jl#Bindings)

### Limitations

InspectDR is mostly limited to 2D plots. Among other things, it does not support:

- 3D plots
- Heatmaps

---

<div class="post-metadata">

### Author: ![dalarev](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dalarev/32/9881_2.png) [@dalarev](https://discourse.julialang.org/u/dalarev)
#### Post date: [February 10, 2021, 1:50pm UTC](https://discourse.julialang.org/t/automatic-adjustment-of-ticks-when-zooming-with-plots-jl/5055/3 "2021-02-10T13:50:04Z")

</div>

Nice, I was also looking for a fix to OP’s issue and InspectDR works well so far. Thanks!

---

<div class="post-metadata">

### Author: ![MA\_Laforge](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ma_laforge/32/385_2.png) [@MA\_Laforge](https://discourse.julialang.org/u/MA_Laforge)
#### Post date: [February 13, 2021, 4:07pm UTC](https://discourse.julialang.org/t/automatic-adjustment-of-ticks-when-zooming-with-plots-jl/5055/4 "2021-02-13T16:07:19Z")

</div>

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:

```julia-auto
pyplot(ticks=:native)

```

or if you set the option in your plot command:

```julia-auto
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):  
 → [https://github.com/JuliaPlots/Plots.jl/issues/3263](https://github.com/JuliaPlots/Plots.jl/issues/3263)

### 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](https://github.com/JuliaPlots/Plots.jl/issues/3284)
