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

Improve section savefig/png in chapter output in file output.md #86

Open
t37w opened this issue Apr 24, 2018 · 8 comments
Open

Improve section savefig/png in chapter output in file output.md #86

t37w opened this issue Apr 24, 2018 · 8 comments

Comments

@t37w
Copy link

t37w commented Apr 24, 2018

The documentation of section "savefig/png" should be improved to reflect the information available in the source code, for example as comments and real examples. Good for a better learning curve of newcomers.

  • list of supported output formats also with same note from source "not all backends support every format"
  • which output formats are supported by every backend
  • default output format

In addition, some information about the resolution used in the output format. I created some png files for my package using gr() backend. They all had a resolution of 3600 x 2400 pixels which is ways too large.
Being able to define the wanted resolution would be great and could reduce / simplify the related workflow.

@mkborregaard
Copy link
Member

Good ideas.
A little weird with the super high resolution in GR - I think that may be something new.

@mkborregaard
Copy link
Member

You can use size to define the size of the plot in pixels.

@t37w
Copy link
Author

t37w commented Apr 25, 2018

Thank you for the hint.
I think you mean, one can write (a complete example to be reproducable)

using Plots;gr() # default window size
x=rand(101); y=rand(101)+10; z=rand(101)+100;
foo=plot(x,y,z,size=(450,300))
png(foo,"Try_save_small_png_v003_plot(x,y,z,size=(450,300))")

The problem is, the appropriate function does an upscaling by a factor of 6 for each axis in the png file. This currently means one has to plot into a "stamp" resulting in not nice graphics.
Maybe this was / is correct for the one or the other backend or is an artifact now.
Or do have another syntax in mind?

Cheers,
Thomas

@mkborregaard
Copy link
Member

@jheinen is this expected with GR?

@t37w
Copy link
Author

t37w commented Apr 25, 2018

As addendum to the high resolution of png files. according to the table
http://docs.juliaplots.org/latest/supported/#keyword-arguments
the backend 'gr' does not support the keyword 'dpi'. Could this be one reason ?

@t37w
Copy link
Author

t37w commented Apr 26, 2018

After some more and deeper investigations, the gr-backend reacts on the plot attribute dpi, example:

foo=plot(x,y,z,dpi=300)
png(foo,"Try_save_small_png_v004_plot(x,y,z,dpi=300))")

This results in a png-file which is 3 times larger for each size parameter.
AFAIK, the scaling should make the width and height smaller.

@t37w
Copy link
Author

t37w commented Apr 27, 2018

Proposal of an extended section of 'savefig' in file 'outpout.md'

I have no experience with pull requests, ... as I'm new to github and the related workflow.
In a fork of PlotDocs I have extended the section about 'savefig' in file 'output.md'. Please see
https://github.com/t37w/PlotDocs.jl/blob/t37w_output_savefig/docs/src/output.md

Cheers,
Thomas

@mkborregaard
Copy link
Member

That looks sensible. It's easier to give feedback if you do a pull request. You can do that here on github by going to JuliaPlots/PlotDocs, clicking "new pull request" then "compare across forks"

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

2 participants