puk
puk

Reputation: 16802

How to make plots larger in GnuPlot

I am generating mapped 3D plots using the following config file (XRANGE and YRANGE are set later)

#!/usr/bin/gnuplot    
reset
set term postscript eps enhanced

set size square
set xlabel "X position"
set ylabel "Y position"

#Have a gradient of colors from blue (low) to red (high)
set pm3d map
set palette rgbformulae 22,13,-31

set xrange [0 : XRANGE]
set yrange [0 : YRANGE]

set style line 1 lw 1

unset key

set dgrid3d 45,45

set hidden3d

splot "data.data" u 1:2:3

The resulting image looks something like this

GnuPlot Image

Note: I have converted to jpg so the quality is lower, and I have placed a border around the image.

A great deal of space is wasted above and below. This is not a problem until I embed the image into a LaTex document, at which point it will look like so (again, pdf document converted to jpg image)

enter image description here

The image on the right is also created with GnuPlot, but it is slightly larger (as is evident by looking at the border I have drawn around the top two images). The reason for this is because GnuPlot pads the 3D plot with top and bottom white space. How can I remove this without having to manually edit all 50+ plots I have?

Upvotes: 3

Views: 9950

Answers (3)

Joce
Joce

Reputation: 2342

Use the <scale> argument in set view, this will magnify the plot without changing text size or title position.

In your case, because you use the map view, you need:

set view 180,0,1.5

where 180,0 is equivalent to map view and 1.5 is the scaling factor.

Upvotes: 1

Raphael Roth
Raphael Roth

Reputation: 27383

I also crop the Bounding Box afterwards, since I hate playing around with margins in gnuplot. I realized that somehow, eps2eps indeed does adjust the bounding box, but it also transforms text (labels etc) into pixel-graphic?!

I usually use "epstool" which conserves text as text when croping the bb, the command I use is:

epstool --copy --bbox in.eps out.eps

Upvotes: 2

puk
puk

Reputation: 16802

There are two solutions to this, one is unreliable, the other is a hack.

  1. Using GnuPlot, the margin settings can be used to specify distances from the appropriate margins. For example, setting lmargin 0 and bmargin 0 essentially pushes the axes off the page. Similar values can be assigned to the tmargin and rmargin to stretch the graph. Although this worked for 2D graphs, it did not work for 3D graphs (I suspect this has to do with the fact that I set the graph to be a square).

  2. When graphs are set to be of square size, Gnuplot still calculates for the entire screen. The eps file can be manipulated directly to change this by looking for a line like so %%BoundingBox: 50 50 410 302 and changing 410 to something smaller. Alternatively, and this is what I did, you can run eps2eps in.eps out.eps and it will crop it for you. Just make sure in.eps is not the same file as out.eps or it won't work.

Upvotes: 4

Related Questions