Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyplot(ticks=:native) doesn't use native ticks #3284

Closed
jonniedie opened this issue Feb 8, 2021 · 7 comments
Closed

pyplot(ticks=:native) doesn't use native ticks #3284

jonniedie opened this issue Feb 8, 2021 · 7 comments

Comments

@jonniedie
Copy link

jonniedie commented Feb 8, 2021

Details

I'd like to use pyplot(ticks=:native) so my ticks and grid lines will update when I zoom. It seems to do some floating point label weirdness though:

using Plots
pyplot(ticks=:native)
plot(rand(100))

image

When I use PyPlot directly, this doesn't happen:

using PyPlot
plot(rand(100))

image

Backends

This bug occurs on ( insert x below )

Backend yes no untested
gr (default) x
pyplot x
plotly x
plotlyjs x
pgfplotsx x
inspectdr x

Versions

Plots.jl version: v1.6.8
Backend version (]st -m): v2.9.0
Output of versioninfo():

julia> versioninfo()
Julia Version 1.5.3
Commit 788b2c77c1 (2020-11-09 13:37 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Xeon(R) E-2276M  CPU @ 2.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, skylake)
@jonniedie jonniedie added the bug label Feb 8, 2021
@ma-laforge
Copy link
Contributor

Yes. I've noticed that too. That's very strange. It shouldn't technically be an issue with setting the "major formatter" to display all digits (because 1 is precisely represented using floating point values).

As a temporary workaround, you could use Plotly(JS) or InspectDR.jl which also are interactive backends.

I haven't tried Plotly, but I know InspectDR.jl (my own backend) doesn't suffer from this issue when ticks:=native.

Please be aware that in InspectDR:

  • panning is done with shift+click+mouse drag, and
  • zooming is done with a right-mouse-button box zoom.

(NOTE: I am not really part of Plots.jl's core team, so I don't really have much more to contribute, sorry.)

@isentropic
Copy link
Member

@jonniedie I'm able to reproduce this with commit head half a year ago, probably something else has changed, not really the pyplot.jl backend code

@isentropic
Copy link
Member

However the zooming updates the numbers on the ticks right?

@isentropic
Copy link
Member

I believe the issue is due to Showoff.jl as it gives the tick locations. Would someone be able to test out JuliaGraphics/Showoff.jl#31 with Ryu enabled to see if this persists?

@isentropic
Copy link
Member

This is very curious and I have no idea what is happening. Also, the digit problem is so much more apparent now. I'm a little lost why this started happening recently, as I remember native ticks to be working fine. Perhaps matplotlib itself changed or something? I'm running

v"3.3.2"

@isentropic
Copy link
Member

Perhaps @daschw has some ideas, I'm lost with this issue

@isentropic
Copy link
Member

@jonniedie
82f31c4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants