the special filename "++" produces x,y-pairs, nothing more
(gnuplot manual, chapter 65.2.14):
-5 5
-5 4
...
to use these data for vectors you need to re-use the x- and y-data 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 x-cordinates
>> set samples 11
>> # only integer y-cordinates
>> set isosamples 11
>> # we need data, so we use the special filename "++", which
>> # produces x,y-pairs
>> plot "++" using 1:2:1:(2.*$2) with vectors
>>
>>
>
>
--
View this message in context: http://old.nabble.com/Vector-Fields-tp32953675p32958791.html
Sent from the Gnuplot - User mailing list archive at Nabble.com.
|