 not so Frequently Asked Questions  update 2004/9/5


not so FAQ 
About 2Dimensional Plot (No.1)I want to make a fixedsize plot.The area in which gnuplot draws a graph depends on axis and tic labels. To fix the size of the graph, you need to adjust margins by set margin . An option of this command is the number of letters. There are four kinds of margin, top (tmargin), bottom (bmargin), left (lmargin), and right (rmargin). As the defaults all margins are calculated automatically. Current setting can be displayed by: gnuplot> show margin lmargin is computed automatically bmargin is computed automatically rmargin is computed automatically tmargin is computed automatically The next shows an example in the case that all margins are given manually. gnuplot> set lmargin 10 gnuplot> set bmargin 3 gnuplot> set rmargin 2 gnuplot> set tmargin 1 When the margins are defined explicitly like above, the size of graph does not change even formats of the X and Y tics are changed. To fix the position of axis labels, specify the offset options of set {xy}label command. I want to use both sides of Yaxes.It sometimes happens that one wants to put several graphs in one plot. With gnuplot you can use top and bottom axes, and left and right axes separately. As the defaults Y2 axis is the same as the Y (left) axis. Let's make those two axes different, and plot sin(x) and its square at the same time. An option of axis in the plot command defines which axis is used for scaling. The syntax is axis + x1y1, x1y2, x2y1, x2y2. For example axis x1y2 means that this function or data will be scaled by the bottom Xaxis and the right Yaxis. gnuplot> set xrange [0:2*pi] gnuplot> set yrange [1:1] gnuplot> set y2range [0:1] gnuplot> plot sin(x) axis x1y1, \ sin(x)**2 axis x1y2 In this case the tics on the right axis is the same as those on the left axis. To make those different one can use a nomirror option to the set ytics command, and set y2tics makes different axis on the right border. gnuplot> set y2tics 0, 0.2 gnuplot> set ytics nomirror When you use the both axes, you need to specify which axis is used for each data. An arrow is often used for this purpose. This can be done by set arrow . I want to erase axes.Gnuplot draws top, bottom, left, and right frames. To erase those frames, use set border n . An integer is assigned for each frame line, the bottom is 1, left 2, top 4, and right 8. The option n is the sum of those integers. For example, only X1 axis is shown if n=1, X1 and Y1 axes for n=3, all four border lines for n=31. The set border command only affects the border lines, so that tics remain even if n=0. In order to erase axes, you need set no{xy}tics or set {xy}tics nomirror. The following example shows how to erase the top and right border. gnuplot> set border 3 gnuplot> set xtics nomirror gnuplot> set ytics nomirror I want to draw a square or fixed aspect ratio figure.This subject had been known for the old version gnuplot as a very difficult matter, but it is supported nowadays. To make a square plot, give an option square to the set size command. gnuplot> set size square Similarly, to fix the aspect ratio: gnuplot> set size ratio 2 In this case the Y axis length is two times longer than the X axis. This ratio is independent of the values of the X and Y axes. In order to set the scales so that the unit has the same length on both the X and Y axes, give negative value for the ratio. If the ratio is 1, the unit length for the X axis is the same as that for the Y axis. If 2, the Y axis becomes two times longer.
