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

Change vgsvg.DPI from 90 to 96 #491

Closed
chmike opened this issue Jan 7, 2019 · 2 comments · Fixed by #492
Closed

Change vgsvg.DPI from 90 to 96 #491

chmike opened this issue Jan 7, 2019 · 2 comments · Fixed by #492

Comments

@chmike
Copy link
Contributor

chmike commented Jan 7, 2019

What are you trying to do?

Generate Plots saved in SVG.

What did you do?

Saved the plot as SVG. Displayed the plot uisng the SVG previewer of studio code, and displayed the plot using Inkscape.

What did you expect to happen?

Get same plot image as with PNG.

What actually happened?

The image frame was bigger than the plot frame. The plot size was requested to be 4*vg.Inch x 4*vg.Inch. The generated svg xml had an svg tag with width and hight defined as 4in as expected. But the plot was smaller.

image

This is because vgsvg assume that the DPI is 90 while it should be 96. According to this stackoverflow question the DPI of svg has been aligned to the DPI of CSS which is 96. For that reason Inkscape changed it from 90 to 96 in version 0.92. In firefox, the DPI is also 96, but the resulting framing error is not directly visible since the margin is transparent.

Here is another reference stating that the DPI of SVG is aligned to the DPI of CSS and it is 96.

What version of Go and Gonum/plot are you using?

Latest as today, installed with go get.

Does this issue reproduce with the current master?

Don't know.

sbinet added a commit to sbinet-gonum/plot that referenced this issue Jan 7, 2019
sbinet added a commit to sbinet-gonum/plot that referenced this issue Jan 7, 2019
@sbinet
Copy link
Member

sbinet commented Jan 7, 2019

thanks for the issue.
could you test #492 and report whether it fixes it on your end?

thanks.

@chmike
Copy link
Contributor Author

chmike commented Jan 7, 2019

Test is successful. Your change fix the issue.

sbinet added a commit to sbinet-gonum/plot that referenced this issue Jan 11, 2019
sbinet added a commit to sbinet-gonum/plot that referenced this issue Jan 11, 2019
sbinet added a commit to sbinet-gonum/plot that referenced this issue Jan 11, 2019
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

Successfully merging a pull request may close this issue.

2 participants