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

wrong plot size in gr.jl example on a mac retina display #48

Closed
piever opened this issue Sep 24, 2017 · 5 comments
Closed

wrong plot size in gr.jl example on a mac retina display #48

piever opened this issue Sep 24, 2017 · 5 comments

Comments

@piever
Copy link

piever commented Sep 24, 2017

Not sure if it's a GR or a QML issue. On my machine (mac OS using built in retina display) when I run the example "gr.jl", the plot has the wrong size:

screen shot 2017-09-24 at 18 52 39

For it to be of a more appropriate size I need to manually change this line to

plt[:size] = (width(dev)/2, height(dev)/2)

screen shot 2017-09-24 at 18 52 07

I wonder if it's a bug with pixel doubling in retina display. I don't know how the plot would look like on another machine.

@barche
Copy link
Collaborator

barche commented Sep 24, 2017

This is definitely due to the Retina display. In the console there should be output like this:

pixel ratio: 1.0

Hopefully with a value different from 1.0, can you confirm that and tell me the value (presumably 2 or 0.5)?

@piever
Copy link
Author

piever commented Sep 24, 2017

I see, so you should divide width(dev) and height(dev) by the pixel ratio to get the correct size.

Here's my output:

julia> include(joinpath(Pkg.dir("QML"), "example", "gr.jl"))
WARNING: redefining constant screeninfo
pixel ratio: 2.0
screeninfo.pixel_ratio = 2.0
"Example of GR.jl integration\n"

@piever
Copy link
Author

piever commented Sep 26, 2017

Just noticed, that's the solution chosen in GR.jl, see here:

https://github.com/jheinen/GR.jl/blob/master/examples/qml_plots_ex.jl#L27

@barche
Copy link
Collaborator

barche commented Sep 27, 2017

OK, cool, I'll update the example also with some control points, but I still need to work out some problems with the coordinate conversion.

@ufechner7
Copy link
Member

Should work in QML 0.8

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

No branches or pull requests

3 participants