Tuesday, November 22, 2011

How to plot nothing using gnuplot

Some times we just want to create a figure with only the axes ticks and so on, no any content (The content may be added later use some other tools). We know that if there is not a plot command, gnuplot will not create a output picture, So play some tricks should be played. In this post I will talk on two methods to plot nothing using gnuplot.

The first one is plot a line with background color.
reset
set term png font ",20" xffffff  #set png terminal and the background color is white
set output "blank.png"
set key off
set ytics 0.5
plot sin(x) with line linecolor rgb"#ffffff"
set output

The second one is plot something out of yrange.
set term png font ",20"
set output "blank.png"
set yrange [-1:1]
set key off
plot 2 with lines
set output
Maybe some other methods also exist, But this three shold be the most used and simplest ones. At last a sample picture posted. (The two methods will just creat pictures the simillar as this one.)
Plot nothing using gnuplot

Tuesday, November 15, 2011

Aviodding the blank margin of a eps picture being auto croped by some softwares

Some one complained to me that when he inserted a gnuplot produced eps picture into some software (not all) the blank margins are auto cropped. And he want to avoid this to happen.
Yes, I also found this problem myself. Some software "intelligently" crop the blank margin of a postscript picture. Always this is just OK. But in some special cases, we set a blank margin of special purpose, for example, to leave some spaces for readers to add some notes. In these cases, the "intelligence" becomes "stupid".
I solve this problem by adding a invisible rectangle (with linewidth equals 0 or with color same as the background color and fillstyle onborder) as large as the screen, i.e.,
set object rectangle from screen 0,0 to screen 1,1 \
    lw 0 fillstyle noborder behind   
Then although there are blank margins but they are not blank in fact. So when the picture is inserted to other software, the margin will not be auto cropped.
Creative Commons License
Except as otherwise noted, the content of this page is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.