From: Thomas Sefzick <t.sefzick@fz...>  20111211 16:43:49

set xrange [5:5] set yrange [5:5] # only integer xcordinates set samples 11 # only integer ycordinates set isosamples 11 # we need data, so we use the special filename "++", which # produces x,ypairs plot "++" using 1:2:1:(2.*$2) with vectors Soothfast wrote: > > The document gnuplot.pdf, as a means of learning gnuplot "from the ground > up," seems to be a lost cause. It's the first time, in ten years of > learning new programs, software and systems (and Java and FORTRAN), that > I've run up against a genuinely unreadable manual. It's main use for me > is to remind me of certain things I figured out before but need to freshen > up on after a week of disuse. > > So I'll have to learn things by example. I'm aware of the site > http://gnuplot.sourceforge.net/demo/. It's quite good for figuring out > how to come up with pretty pictures of scalarvalued functions and > surfaces, but now I want to be able to make simple vector fields. All > roads seem to lead to the same example: > http://gnuplot.sourceforge.net/demo/vector.html. But it's far too > complicated and has too many other extraneous things (whoopdedoo contour > lines and other bells and whistles) for me to zero in on the code for > making a simple 2D vector field. > > Let F(x,y) = <x,2y> be the vector field that assigns to each point (x,y) > the vector <x,2y>, using the typical calculus text notation. What code, > minimally, will produce this vector field in the window [5:5]x[5:5] at > points with, say, integer coordinates? > > Also, IS there any decent book or website out there that helps explain > these things better? >  View this message in context: http://old.nabble.com/VectorFieldstp32953675p32955838.html Sent from the Gnuplot  User mailing list archive at Nabble.com. 
From: Thomas Sefzick <t.sefzick@fz...>  20111212 14:35:13

the special filename "++" produces x,ypairs, nothing more (gnuplot manual, chapter 65.2.14): 5 5 5 4 ... to use these data for vectors you need to reuse the x and ydata for the direction data which is needed for a vector (x,y,xdelta,ydelta; see gnuplot manual, chapter 44), here (x,y,xdelta=x,ydelta=2y): plot ... using 1:2:1:(2.*$2) with vectors to scale the vector length, scale xdelta and ydelta: plot ... using 1:2:(0.5*($1)/sqrt(($1)**2+($2)**2)):(0.5*(2.*$2)/sqrt(($1)**2+($2)**2)) ... 'set table' gives plot coordinates, but not input data. Soothfast wrote: > > Much appreciated, Thomas. Quite nice. > > So, one big problem I had with the gnuplot.pdf manual is that it gave no > satisfactory explanation for how the "using" command works. As far as I > could work out, "using 1:2:4" indicates using the first, second and fourth > columns of data in a data file, but since no actual data file is ever > shown and examples are sparse, I can not even remotely envision how things > "connect" contextually. So, to fully understand your code, I have to know > what at least one line of the "++" data file looks like. Putting "set > table" into your code lets me see it, and I can see that the first line is > > 5 5 5 10 i > > (Just an aside, but I find it odd that y starts at 5 instead of 5). > > Okay, so one more question, and then I'll go get the book "GNUplot in > Action" and maybe become less of a pest: What about a direction field? > That is, how can we make all the arrows in the vector field have the same > length of, say, 0.5? It looks like the file "++" would need a fifth > column > > 0.5*($3)/sqrt(($3)**2+($4)**2) > > and a sixth column > > 0.5*($4)/sqrt(($3)**2+($4)**2) > > (hope I have the syntax right) and then somehow get a plot of "++" using > 1:2:5:6 with vectors. Am I close? (I'll be teaching a differential > equations class in the spring.) > > > > > Thomas Sefzick wrote: >> >> set xrange [5:5] >> set yrange [5:5] >> # only integer xcordinates >> set samples 11 >> # only integer ycordinates >> set isosamples 11 >> # we need data, so we use the special filename "++", which >> # produces x,ypairs >> plot "++" using 1:2:1:(2.*$2) with vectors >> >> > >  View this message in context: http://old.nabble.com/VectorFieldstp32953675p32958791.html Sent from the Gnuplot  User mailing list archive at Nabble.com. 