PlotDocs.jl icon indicating copy to clipboard operation
PlotDocs.jl copied to clipboard

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

Open t37w opened this issue 7 years ago • 8 comments

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.

t37w avatar Apr 24 '18 20:04 t37w

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

mkborregaard avatar Apr 24 '18 20:04 mkborregaard

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

mkborregaard avatar Apr 24 '18 20:04 mkborregaard

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

t37w avatar Apr 25 '18 18:04 t37w

@jheinen is this expected with GR?

mkborregaard avatar Apr 25 '18 19:04 mkborregaard

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 avatar Apr 25 '18 19:04 t37w

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 avatar Apr 26 '18 19:04 t37w

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

t37w avatar Apr 27 '18 20:04 t37w

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"

mkborregaard avatar May 01 '18 11:05 mkborregaard