How to draw just arrow in gnuplot

20,339

Solution 1

If you set explicit axis ranges you can plot NaN to get a clean set of axes.

Also, notitle or t '' is needed to hide the key for NaN.

set xrange [0:5]
set yrange [0:5]
set arrow from 0,0 to 1,1
plot NaN t ''

plot output

Solution 2

To plot only an arrow with coordinates given in the units of the usual axes, one can use the vectors plotting style.

# gnuplot 5
$data <<EOD
0 0 1 1
EOD
plot $data u 1:2:3:4 w vectors

or

# gnuplot 4.x
plot '-' u 1:2:3:4 w vectors
0 0 1 1
e
Share:
20,339
user984260
Author by

user984260

Updated on July 09, 2022

Comments

  • user984260
    user984260 almost 2 years

    In gnuplot, we draw arrow as:

    set arrow from 0,0 to 1,1
    

    I want to make a plot with just arrows and no other data. How can I do this. Right now, after setting arrows, I need to give something to plot, since without that arrows don't get plotted. Is it possible to draw just an empty 'plot' without any data?

    I have also seen online help on gnu etc., but could not get the answer resolved.

  • mgilson
    mgilson about 11 years
    This is correct. However, rather than all that funky shell redirection/pipe business, you can just do plot NaN
  • Digikata
    Digikata about 11 years
    Thanks, I've updated the plot command from the previous: plot "<echo 10 20" u 1:2