|
From: Ethan A M. <merritt@u.washington.edu> - 2007-04-15 15:28:19
|
On Sunday 15 April 2007 00:44, Pawel Cesar Sanjuan Szklarz wrote:
> Hi.
> the plot
> splot '+' 1:2:(sin($1)*$2*$2):(cos($2)*$1*$1) with vectors
> is not working. I not found any splot with vectors example in the demo files:
> bash: grep splot * | grep vectors
I did not have the command quite right. I was forgetting that for splot you
need to give a z coordinate for each endpoint, even if they are all the same.
This works:
set samples 10
set isosamples
set xrange [0:1]
set yrange [0:1]
set view map
splot '+' using 1:2:0:(sin($1)/20.):(cos($2)/20.):0 with vectors
> But what I need is a 2d plot with vectors, the same as
Yes, if you are reading the coordinates from a file then you can do this
with "plot". But in order to auto-generate a 2D grid, you need to use
"splot". The normal use for splot is to generate 3D plots, by associating
a Z value with each [x,y] sample. However, my example above re-uses the
x and y coordinates to calculate each end of a vector in the plane Z=0.
I have attached the output of my example as an *.eps file.
As I said, this is a very new feature, and you may be able to suggest
enhancements to make it better.
Ethan
> gnuplot>plot 'mydataField.dat' using 1:2:3:4 with vectors
>
> where in the file 'mydataField.dat' I have
> x y sin(x)*y^2 cos(y)x^2
> calculated for all points.
>
> I would like to get the same using something like special functions:
> gnuplot>plot '+' using 1:2:(sin($1)*$2*$2):(cos($2)*$1*$1) with vectors
>
> Pawel Szklarz.
>
> 2007/4/14, Ethan A Merritt <merritt@u.washington.edu>:
> > On Saturday 14 April 2007 10:29, Pawel Cesar Sanjuan Szklarz wrote:
> > > Hi
> > >
> > > I am interested in add a feature do gnuplot: 2d vector fields from
> > > R^2->R^2 functions
> > >
> > > example:
> > > gnuplot>plot (sin(x)*y^2,cos(y)x^2) with 2dVectorField
> >
> > Please have a look at the very recent feature added to the cvs version:
> >
> > gnuplot> help special-filenames
> > There are three filenames that have a special meaning: '', '-', and '+'.
> > The special filename '+' is a mechanism to allow the full range of
> > `using` specifiers and plot styles with in-line functions. Normally a
> > function plot can only have a single y (or z) value associated with each
> > sampled point. The pseudo-file '+' treats the sampled points as columns
> > 1 (plot) or 1 and 2 (splot), and allows additional column values to be
> > specified via a `using` specification, just as for a true input file.
> > Example:
> > plot '+' using ($1):(sin($1)):(sin($1)**2) with filledcurves
> >
> >
> > You may be able to use this new mechanism to do your plotting.
> > Or maybe not. I'm not sure I understand what is the intended output
> > from your example. Is it a set of vectors, with each vector connecting
> > (x,y) to (sin(x)*y^2, cos(y)*x^2) ? That would be something like
> > splot '+' 1:2:(sin($1)*$2*$2):(cos($2)*$1*$1) with vectors
> > You may have to change "set isosamples" first.
> >
> > Of course Octave doesn't yet know about this option, but I'm sure
> > that can be fixed.
> >
> >
> >
> > >
> > > I know that it is possible to create a datafile with the information
> > > about the vector field, but it can be nice to make zoom and don't
> > > worry about the data density in the datafile.
> > >
> > > I would like to add another feature: I would like to use octave (for
> > > example) to calculate the value of some function.
> > > My proposition is not to run octave many times, but to create a
> > > children process and send/recibe values by PIPES, example:
> > >
> > > gnuplot>open calculator 'myCulculatorProgram'
> > > now gnuplot forks and create a children process
> > > "system('myCulculatorProgram')" and is ready to use that program to
> > > calculate something (open 2 pipes gnuplot<-->Mycalculator)
> > > gnuplot>plot calculator('myExternalFunctionName',x,y)
> > > To calculate the value of
> > > calculator('myExternalFunctionName',x,y)
> > > gnuplot send data by the pipe to the children process and white for
> > > the results in another pipe.
> > >
> > > This feature can by really great, octave is what I need, but with this
> > > mechanism it is possible even to send SOAP request to some special
> > > mega-calculation-server or what ever.
> > >
> > > I have ready some code for this feature, but i would like to know:
> > > --can be this useful?
> > > -- it is possible to make something equivalent with gnuplot in some other way
> > > And if this is a new feature, then:
> > > -- what format to use for this features (represent R2->R2 functions,
> > > and the external calculator)
> > > -- how to submit code to CVS
> > >
> > > Thanks
> > >
> > > -------------------------------------------------------------------------
> > > This SF.net email is sponsored by DB2 Express
> > > Download DB2 Express C - the FREE version of DB2 express and take
> > > control of your XML. No limits. Just data. Click to get it now.
> > > http://sourceforge.net/powerbar/db2/
> > > _______________________________________________
> > > gnuplot-beta mailing list
> > > gnu...@li...
> > > https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
> > >
> >
> > --
> > Ethan A Merritt
> > Biomolecular Structure Center
> > University of Washington, Seattle 98195-7742
> >
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> gnuplot-beta mailing list
> gnu...@li...
> https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
>
--
Ethan A Merritt
Biomolecular Structure Center
University of Washington, Seattle 98195-7742
|