How do I use gnuplot to plot a simple 2d vector arrow? -


this first time trying use gnuplot, , can't find instructions on how accomplish this. closest found this:

http://gnuplot.sourceforge.net/docs_4.2/node259.html

plot 'file.dat' using 1:2:3:4 vectors head filled lt 2

but can't find explanation "file.dat".

so can give simple example of how draw simple 2d vector arrow? thanks.

gnuplot has help/documentation build in. type help plot or help vector learn more on how plot vectors in gnuplot.

the 2d vectors style draws vector (x,y) (x+xdelta,y+ydelta).

a small arrowhead drawn @ end of each vector.

4 columns: x y xdelta ydelta

this means, input file should have 4 columns, first 2 columns define starting (x,y)-position of vector/arrow , last 2 (x,y) direction:

# file.dat 0   0   .5  .5 0   1   -.5 .5 1   1   1    0 

now typing following command

plot "file.dat" using 1:2:3:4 vectors filled head lw 3 

gives following output: plotting vectors

drawing vectors set arrow command

consider using set arrow command, if need draw few vectors/arrows (e.g. highlight points in plot).

  set arrow 1 pi/2,1 pi/2,0    set arrow 2 pi*3/2,-1 pi*3/2,0    plot[0:2*pi] sin(x) 

set arrow example


Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -