user984260
user984260

Reputation: 3543

How to draw just arrow in gnuplot

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.

Upvotes: 9

Views: 26426

Answers (2)

Digikata
Digikata

Reputation: 1959

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

Upvotes: 11

Christoph
Christoph

Reputation: 48390

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

Upvotes: 1

Related Questions