A few simple graphing questions
SteveHatcher
I love the graphs Igor Pro produces but am a beginner. Could I please have some assistance on the following issues:
1. Can I use the procedure window as a script? I have all of my graphing code in the procedure window, but how do I 'run it' so it produces my graph (like a script in MATLAB?) All I can see is compile.
2. How can I modify a range of points when using ModifyGraph?
I can do this:
ModifyGraph rgb(wave0[0])=(0,0,65280)
but I want to modify several wave0 points. Right now I do it by hand:
ModifyGraph rgb(wave0[0])=(0,0,65280)
ModifyGraph rgb(wave0[5])=(0,0,65280)
ModifyGraph rgb(wave0[10])=(0,0,65280)
ModifyGraph rgb(wave0[15])=(0,0,65280)
Is there a single way to do this? Something like ModifyGraph rgb(wave0[0,5,10])=(0,0,65280)
Also can it be doing with selecting a certain range? E.g. if I have 25 points, and I want points 0 to 20 in 5 step increments? In MATLAB this would be 0:5:20
Thanks for all your help
My procedure to plot the graph is literally
#pragma rtGlobals=3 // Use modern global access method and strict wave access.
Display wave0 vs wave1
ModifyGraph mode=3,marker=19
...etc etc
Am I doing it right? Can it be used like a MATLAB script?
Thanks
June 28, 2016 at 11:17 pm - Permalink
The longer answer is that to write something that's more flexible you'd need to know the window name, the trace names, point ranges, colours (how to specify them etc).
To simply do the same thing to save you typing it over and over. Put this in the procedure window:
//put your code here
End
Press compile. Select the graph you want, then type in the Command Window "DoYourThing()". This should run your code on the top graph window.
June 28, 2016 at 11:31 pm - Permalink
Just wondering if there is a solution to my first question? To index multiple points when Modifying the graph.
Thanks
June 29, 2016 at 01:19 am - Permalink
More information can be found in
displayhelptopic "ModifyGraph for Traces"
HJ
June 29, 2016 at 03:01 am - Permalink
Run displayhelptopic "indexing and subranges" from the command window for more detail.
I vaguely recalled this feature, but had to do a quick look up in the manual to be sure.
June 29, 2016 at 05:05 am - Permalink
An f(z) approach is a good idea.
colorwave=0
colorwave[0,*;5] = 1
ModifyGraph zColor(wave0)={colorwave,*,*,Rainbow,1}
Hopefully this gives you an idea.
June 29, 2016 at 05:05 am - Permalink
June 29, 2016 at 05:55 am - Permalink
This function might answer a few of your questions.
// tname - trace name to modify (on front graph!)
// wpoints - selected points to modify (as a wave)
// rgbset - rgb color values in 3 point wave
Function ColorCertainPoints(tname,wpoints,rgbset)
string tname
wave wpoints, rgbset
variable ic, pnt
for (ic=0;ic<numpnts(wpoints);ic+=1)
pnt = wpoints[ic]
ModifyGraph rgb($tname[pnt]) = (rgbset[0],rgbset[1],rgbset[2])
endfor
return 0
end
Put it in the procedure window and compile. Select the graph you want. Type the commands below in the command line.
make/N=10 ywave = p^2
make/N=3 ptocolor = {0,3,8}
display ywave
ModifyGraph mode=3
ColorCertainPoints("ywave", ptocolor, rgbset)
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
June 29, 2016 at 07:02 am - Permalink
DisplayHelpTopic "Setting Trace Properties from an Auxiliary (Z) Wave"
If you haven't done it already, be sure to select Help->Getting Started and go through at least the first half of the Guided Tour. It takes a bit of time but will save more time by introducing you to some of the quirks of Igor's operation and his way of "thinking". And you may wish to read the Graphs chapter in the manual. It will cure insomnia and also tell you just about everything you need to know about graphs.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
June 29, 2016 at 09:36 am - Permalink