Re: [Gnuplot-info] Plotting multiple arrows in gnuplot From: Thomas Sefzick - 2009-07-06 13:51 ```l=1. plot 'datafile' using 1:2:(l*cos(\$3)):(l*sin(\$3)) with vectors use 'l' to adjust the length of the vectors. a.g.s.maxwell wrote: > > I have a data file with 3 columns (x,y,theta), and I have plotted a graph > of the x and y positions. Now I need to draw an arrow from each (x,y) to > (x+cos(theta),y+sin(theta)) which is easily done by typing in each point > separately but I will need to do it for up to 1000 points, so can anyone > help me with some code that will automatically assign an arrow to every > point on the graph according to the directions above? > > Thanks > -- View this message in context: http://www.nabble.com/Plotting-multiple-arrows-in-gnuplot-tp24354889p24355741.html Sent from the Gnuplot - User mailing list archive at Nabble.com. ```
 Re: [Gnuplot-info] Plotting multiple arrows in gnuplot From: Thomas Sefzick - 2009-07-07 10:53 ```plot your data again with the yrange interval added to or subtracted from the data: dy=3 set yrange [0:0+dy] plot "datafile" using 1:2:(l*cos(\$3)):(l*sin(\$3)) with vectors, \ "" using 1:(\$2+dy):(l*cos(\$3)):(l*sin(\$3)) with vectors, \ "" using 1:(\$2-dy):(l*cos(\$3)):(l*sin(\$3)) with vectors to get the same color for all plots add 'linetype' options. a.g.s.maxwell wrote: > > Is it possible to have periodic boundaries, so if the vector arrow goes > out the top, it will come back in at the bottom of the graph at the same > place at same angle? > > > Thomas Sefzick wrote: >> >> l=1. >> plot 'datafile' using 1:2:(l*cos(\$3)):(l*sin(\$3)) with vectors >> >> use 'l' to adjust the length of the vectors. >> >> >> a.g.s.maxwell wrote: >>> >>> I have a data file with 3 columns (x,y,theta), and I have plotted a >>> graph of the x and y positions. Now I need to draw an arrow from each >>> (x,y) to (x+cos(theta),y+sin(theta)) which is easily done by typing in >>> each point separately but I will need to do it for up to 1000 points, so >>> can anyone help me with some code that will automatically assign an >>> arrow to every point on the graph according to the directions above? >>> >>> Thanks >>> >> >> > > -- View this message in context: http://www.nabble.com/Plotting-multiple-arrows-in-gnuplot-tp24354889p24368343.html Sent from the Gnuplot - User mailing list archive at Nabble.com. ```
 Re: [Gnuplot-info] Plotting multiple arrows in gnuplot From: Thomas Sefzick - 2009-07-08 14:32 ```if you want a wrap-around for all boundaries you need to extend the plot command a little bit: set clip points set clip one set clip two l=3. x1=0.5 y1=1.5 dx=3 dy=3 set xrange [x1:x1+dx] set yrange [y1:y1+dy] plot "datafile" using 1:2:(l*cos(\$3)):(l*sin(\$3)) with vectors, \ "" u 1:(\$2+dy):(l*cos(\$3)):(l*sin(\$3)) w vec, \ "" u 1:(\$2-dy):(l*cos(\$3)):(l*sin(\$3)) w vec, \ "" u (\$1+dx):2:(l*cos(\$3)):(l*sin(\$3)) w vec, \ "" u (\$1-dx):2:(l*cos(\$3)):(l*sin(\$3)) w vec, \ "" u (\$1-dx):(\$2-dy):(l*cos(\$3)):(l*sin(\$3)) w vec, \ "" u (\$1-dx):(\$2+dy):(l*cos(\$3)):(l*sin(\$3)) w vec, \ "" u (\$1+dx):(\$2-dy):(l*cos(\$3)):(l*sin(\$3)) w vec, \ "" u (\$1+dx):(\$2+dy):(l*cos(\$3)):(l*sin(\$3)) w vec with the datafile: 1 3 0.3 2 3 0.6 3 3 0.9 you'll get the following plot: http://www.nabble.com/file/p24391677/ts.gif ts.gif a.g.s.maxwell wrote: > > This doesn't make the vector arrows wrap around. All the data points will > be within range [0:3] and the vectors are pointing to the position at next > time step, which is why I want the vector arrows to go out one boundary > and in the other. > > > Thomas Sefzick wrote: >> >> plot your data again with the yrange interval added to >> or subtracted from the data: >> >> dy=3 >> set yrange [0:0+dy] >> plot "datafile" using 1:2:(l*cos(\$3)):(l*sin(\$3)) with vectors, \ >> "" using 1:(\$2+dy):(l*cos(\$3)):(l*sin(\$3)) with vectors, \ >> "" using 1:(\$2-dy):(l*cos(\$3)):(l*sin(\$3)) with vectors >> >> to get the same color for all plots add 'linetype' options. >> >> >> a.g.s.maxwell wrote: >>> >>> Is it possible to have periodic boundaries, so if the vector arrow goes >>> out the top, it will come back in at the bottom of the graph at the same >>> place at same angle? >>> >>> >>> Thomas Sefzick wrote: >>>> >>>> l=1. >>>> plot 'datafile' using 1:2:(l*cos(\$3)):(l*sin(\$3)) with vectors >>>> >>>> use 'l' to adjust the length of the vectors. >>>> >>>> >>>> a.g.s.maxwell wrote: >>>>> >>>>> I have a data file with 3 columns (x,y,theta), and I have plotted a >>>>> graph of the x and y positions. Now I need to draw an arrow from each >>>>> (x,y) to (x+cos(theta),y+sin(theta)) which is easily done by typing in >>>>> each point separately but I will need to do it for up to 1000 points, >>>>> so can anyone help me with some code that will automatically assign an >>>>> arrow to every point on the graph according to the directions above? >>>>> >>>>> Thanks >>>>> >>>> >>>> >>> >>> >> >> > > -- View this message in context: http://www.nabble.com/Plotting-multiple-arrows-in-gnuplot-tp24354889p24391677.html Sent from the Gnuplot - User mailing list archive at Nabble.com. ```