Plotting Vector Fields
WmVoje
I'm trying to plot some basic vector fields - I've looked around and it seems that Gizmo's "scatter arrows" experiment is the best that Igor has to offer. I'm not really impressed with the interface nor how the plots look.
Are there any other options for plotting vector fields?
Any help would be greatly appreciated.
Regards,
-Willy Voje
Yes. Here is a very simple example:
Make/O xData = {1, 2, 3}, yData = {1, 2, 3}
Display yData vs xData // Make graph
ModifyGraph mode(yData) = 3 // Marker mode
// Make an arrow data wave to control the length and angle for each point.
Make/O/N=(3,2) arrowData // Controls arrow length and angle
Edit /W=(439,47,820,240) arrowData
// Put some data in arrowData
arrowData[0][0]= {20,25,30} // Column 0: arrow lengths in points
arrowData[0][1]= {0.523599,0.785398,1.0472} // Column 1: arrow angle in radians
// Set trace to arrow mode to turn arrows on
ModifyGraph arrowMarker(yData) = {arrowData, 1, 10, 1, 1}
// Make an RGB color wave
Make/O/N=(3,3) arrowColor
Edit /W=(440,272,820,439) arrowColor
// Store some colors in the color wave
arrowColor[0][0]= {65535,0,0} // Red
arrowColor[0][1]= {0,65535,0} // Green
arrowColor[0][2]= {0,0,65535} // Blue
// Turn on color as f(z) mode
ModifyGraph zColor(yData)={arrowColor,*,*,directRGB,0}
For details read about the arrowMarker keyword of the ModifyGraph operation.
Also choose File->Example Experiments->Feature Demos2->Barbs and Arrows.
And File->Example Experiments->Graphing Techniques->Arrow Plot.
September 29, 2012 at 08:11 pm - Permalink
It would be best if you specified the dimensionality of your vector fields. If 2D then the example above should work. If 3D you have to use Gizmo.
I agree, Scatter Arrows is not a particularly impressive example. It was created to illustrate a technique and not as a marketing tool. It could, for example look more like the attached image or with a bit more effort you can plaster an image of your favorite politician on each arrow. So, tell us what you need and we'll try to suggest a solution.
A.G.
WaveMetrics, Inc.
October 1, 2012 at 10:29 am - Permalink
The example experiment depends on some complicated seeming footwork to get 2 1d curves to raster scan through the whole 2d space. That is clunky and hard to get right. It would be nice to have a routine where you just give it the functions and Igor does the rest (perhaps using redimension in a fancy way?)
The imagined function might have syntax such as
DoVectorFieldPlot(fx,fy)
Function DoVectorFieldPlot(fx,fy,lineThick,headLen,headFat,posMode)
wave fx,fy
variables lineThick,headLen,headFat,posMode
....
Display ....
End
Thanks,
John Bechhoefer
Department of Physics
Simon Fraser University
Burnaby, BC, Canada
PS Please don't use a complex wave to represent the two components. That's unintuitive and requires that an eventual generalization to 3d use a different syntax.
November 18, 2013 at 10:24 pm - Permalink
•LoadWave/G/D/W/E=1 "C:Lorenz:ANSYS:APDL scripting:forcesxFFT_data.txt"
•duplicate wave0 xcoord
•duplicate wave1 ycoord
•xcoord=wave0*cos(wave1*3.14159/180)
•ycoord=wave0*sin(wave1*3.14159/180)
•Edit xcoord,ycoord
•Display ycoord vs xcoord
•ModifyGraph mode(ycoord)=3
•ModifyGraph msize=0.1
•Make/O/N=(7950,2) arrowData
•Edit arrowData
•arrowData[][0]=wave13[p]
•arrowData[][1]=wave14[p]
•ModifyGraph arrowMarker(ycoord) = {arrowData,1,5,1,0}
•arrowData[][0]=arrowData[p][0]*2
•ModifyGraph rgb=(0,0,0)
•ModifyGraph zColor(ycoord)={wave13,*,*,Rainbow,1}
Joshua Lorenz
Kato Engineering
January 14, 2016 at 12:56 pm - Permalink