Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plotting arrows with gnuplot

Tags:

gnuplot

I have data generated in a simulation. The generated data file looks something like this:

1990/01/01 99
1990/01/02 92.7
1990/01/03 100.3
1990/01/04 44.2
1990/01/05 71.23
...
2100/01/01 98.25

I can create a chart (trivially), by simply issuing the (long versioned) command:

plot "simulation.dat" using 1:2 with line

I want to add a third column which will add arrow information. The encoding for the third column would be as follows:

  • 0 => no arrow to be drawn for that x axis value
  • 1 => an UPWARD pointing arrow to be drawn for the x axis value
  • 2 => a DOWNWARD arrow to be drawn for the x axis value

I am just starting to learn gnuplot, and will appreciate help in how I can use gnuplot to create the arrows on the first plot?

like image 653
oompahloompah Avatar asked Jan 27 '11 10:01

oompahloompah


1 Answers

I dont think there is an automatic way to create all your arrows at the same time based on the third column. You will have to execute the following for each arrow that you want:

set arrow xval1,yval1 to xval2,yval2

You can also use relative arrows

set arrow xval1,yval1 rto 1,0

This will draw a horizontal arrow from xval1,yval1 to (xval1+1),yval1

There are plenty of options associated with the set arrow command:

like image 69
Martin Avatar answered Sep 23 '22 19:09

Martin