eplot icon indicating copy to clipboard operation
eplot copied to clipboard

using size parameter results in cropped image

Open gianniqq opened this issue 8 years ago • 4 comments

Using a command like eplot data.txt -s 2

generates a cropped image instead of a complete bigger image. The command seems to get the image to a higher resolution, but fails to place it in its entirety in a proper "outline"

foo

gianniqq avatar Jul 26 '17 13:07 gianniqq

Can confirm I ran into this issue too.

When used with the dumb terminal option -d, most of the image is cropped away.

travisdowns avatar Sep 03 '18 00:09 travisdowns

I can confirm this. Happens when exporting to png too.

lballardini avatar Jan 17 '20 00:01 lballardini

The way the eplot passes the size parameter to gnuplot, you can only scale down. As stated in the manual (p. 30), in this particular context, size "scales the plot itself relative to the size of the canvas."

I think this is not a bug, rather the -s option just needs to be bounds-checked so that it cannot be greater than 1, otherwise you will get the cropping behavior described here. In light of that, it might be more appropriate to call the option --scale rather than --size, or at least use "scale, not size" as your mnemonic for remembering what eplot -s does.

If you are not happy with the default plot size of 640×480 px (6.25×5 in or ~15.9×12.7 cm at 96 ppi), you could:

  • modify the gnuplot script generated by eplot
    • dump the intermediate data files with eplot -D, if necessary
    • copy-paste or otherwise capture the output (standard error) of eplot into your own gnuplot script
    • then change the canvas size by adding size XDIM, YDIM (in pixels) at the end of the set term line
    • re-run gnuplot with your custom script and the same input files

—or—

  • output to SVG (-g) and scale it with some graphics program of your choice, e.g., Inkscape

—or—

  • modify the eplot script directly to set term TERMTYPE size XDIM, YDIM to your liking (reference)

ernstki avatar Aug 04 '20 23:08 ernstki

@travisdowns If you are just trying to get the plot to fill the terminal, you can apply this patch to your copy of eplot, or else vote for issue #7. Or do both!

If you trust that the patch linked above looks OK, you can apply it directly to your copy of eplot with

cd /the/place/where/you/have/eplot

curl https://github.com/chriswolfvision/eplot/compare/master...ernstki:dumb-auto-size.diff |
    patch -p1

ernstki avatar Aug 04 '20 23:08 ernstki