vinh-du
vinh-du

Reputation: 11

How to improve the magnification of picture (*.png) when exported in gnuplot?

I'd like to improve the magnification of images (*.png) when they are exported in gnuplot. I had tried to increase the pixels of these images but when they are zoomed too many times, the quality is so bad. So could you please help me for this case.

Here are my commands for exporting the images *.png in gnuplot:

set term pngcairo transparent enhanced lw 2.2 \
    font "Century,20" fontscale 1.2 size 1642,1140"

Upvotes: 1

Views: 888

Answers (3)

kebs
kebs

Reputation: 6707

Besides the other answers, here are two other options:

  • increase terminal size (say 4000x3000), until you got something that looks good enough. PNG format is compressed so if most of the plot is white, it won"t add much bytes.
  • As already said, use a vector graphics format as terminal. The others suggest EPS, but is less common today than svg. The SVG terminal produces .svg files that can be easily post-processed with a tool such as Inkscape.

Upvotes: 0

ilent2
ilent2

Reputation: 5241

As mentioned by Miguel, likely the source of your problem is that by exporting a PNG you are exporting an array of pixels. When you zoom in you will start to see the individual pixels of your image.

Probably the best way to solve your problem is to export to some form of vector graphics. Take a look at EPS (side note: most journals will prefer if you submit a vector graphic rather then a PNG).

If you are certain you want to use PNG you should take a look at https://stackoverflow.com/a/9118990/2372604 which mentions changing your terminal to pngcairo to produce smoother results.

Another note to make, if your function is particularly noisy, you may need to increase the number of sample points, consider the command set samples 1000.

Upvotes: 1

Miguel
Miguel

Reputation: 7627

The problem you are facing is not related to gnuplot but to the bitmap nature of png images. Since these images are not vectorial, when you "zoom in" you simply increase the bit size, but not the resolution. The only way to solve this problem is to export to eps instead of png. There are a few terminals in gnuplot that you might be interested in. In my opinion the most powerful is the epslatex terminal: have a look at the documentation with help epslatex.

Upvotes: 2

Related Questions