- not so Frequently Asked Questions -
not so FAQ
Making a small figure inside a figure. Sometimes you may see a magnified plot in a margin to make a crowded part clear. To put such a magnified window, use multiplot. We make about 1/4 of the full-size figure inside the main plot. Firstly draw a main graph in the multiplot mode.
gnuplot> set xrange [ 0 : 20 ] gnuplot> set yrange [ 0 : 6 ] gnuplot> set xtics 5 gnuplot> set ytics 1 gnuplot> set multiplot multiplot> set origin 0.0,0.0 multiplot> set size 1.0,1.0 multiplot> plot "file.dat" u 1:2:3 notitle with yerrorbars,\ > "file.cal" u 1:2 notitle with lines
Move the origin to the vacant place (0.45,0.1), and draw a small graph there. The X and Y ranges should be determined to enlarge the place where you want to magnify. The small figure is the same as the main one except for the ranges, so that you can use the replot command.
multiplot> set origin 0.45,0.1 multiplot> set size 0.5,0.5 multiplot> set xrange [ 1 : 5 ] multiplot> set yrange [ 2.4 : 3.0 ] multiplot> set ytics 0.5 multiplot> replot multiplot> set nomultiplot gnuplot>
Now you can see clearly the part where there exists many data points. We chose the origin and size so as not to overlap those two figures. It is impossible to erase lines and points of the main figure which intrude the small one with gnuplot.
X and Y axis names for the small graph should be empty, even the main figure has those stuff. When you want to make a reduced size EPS, the set size command should be outside the multiplot mode. Otherwise gnuplot defines BoundingBox in your Postscript file so as to include a whole screen. You can see an example in our gallery.
Gnuplot (if older than ver.3.6) draws open rectangulars when with boxes is used to make a bar-chart, as you can see an example. Gnuplot ver.3.8 and newer can draw a filled box.
If you are making a Postscript figure, the easiest way is to draw a figure with impluses with very thick lines. In the next example we defined the line type 1 which is 50 times thicker than the default width.
gnuplot> set term postscript eps enhanced color gnuplot> set linestyle 1 lt 1 lw 50 gnuplot> # for gnuplot ver.4 gnuplot> # set style line 1 lt 1 lw 50 gnuplot> plot "test.dat" using 1:2 with imp ls 1
[ver.4] ONLY !
Gnuplot Ver.4 has an option to fill the boxes, which is with boxes fs [pattern | solid] (fillstyle). Also you can use set style fill to define the color-fill pattern separately.
In the case of with boxes fs pattern , the pattern number is used to specify the filling pattern. In the case of solid option, density of the filled box is given by a value ranging from 0 to 1.
In the example below, (3) stands for the bar-width.
gnuplot> plot "test.dat" usi 1:2:(3) w boxes fs pattern 1,\ gnuplot> "test.dat" usi ($1+5):2:(3) w boxes fs solid 0.7