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

7 comments:

  1. simply use the following command:
    set key off
    plot 1/0

    ReplyDelete
    Replies
    1. Your solution is simple, but it does not work. The command "plot 1/0" is incorrect because " all points y value undefined!"!

      Delete
  2. Correct solution is:
    set key off
    set yrange [-1:1]
    plot 1/0

    ReplyDelete
    Replies
    1. Just to add the one-liner:
      plot [][-1:1] 1/0 t""

      Delete
  3. Another alternative:

    plot sqrt(-1)

    ReplyDelete
  4. And yet another alternative (as oneliner):

    plot [][-1:1] NaN t""

    ReplyDelete

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.