ModifyImage error
J-E Petit
When plotting a new image from a user defined function, I get a ModifyImage error, saying "expected the name of an image in the top graph".
here is the function:
Function RectangularPlot(MxToPlot,PlotName)
wave MxToPlot
string PlotName
SetDataFolder root:NWR:graph_variables:rectangle
wave angle_ticklocator,angle_ticklabel
NVar Radial_res=root:NWR:variables:Radial_res
Display/N=NWRgraph as PlotName;AppendImage MxToPlot
ModifyGraph/W=NWRgraph userticks(bottom)={angle_ticklocator,angle_ticklabel}
ModifyImage/W=NWRgraph MxToPlot ctab= {*,*,Rainbow,1}
ModifyGraph/W=NWRgraph axisEnab(bottom)={0,0.9}
ModifyGraph/W=NWRgraph fStyle(bottom)=1,fSize(bottom)=14,fStyle(left)=1,fSize(left)=14
//ColorScale/W=NWR_graph/C/N=cb_NWR/F=0/A=RC/X=-9.61/Y=0.51 heightPct=110,image=MxToPlot
//ColorScale/W=NWR_graph/C/N=cb_NWR "concentration"
SetScale/P y 0,Radial_res,"Wind speed (km/h)", MxToPlot
End Function
wave MxToPlot
string PlotName
SetDataFolder root:NWR:graph_variables:rectangle
wave angle_ticklocator,angle_ticklabel
NVar Radial_res=root:NWR:variables:Radial_res
Display/N=NWRgraph as PlotName;AppendImage MxToPlot
ModifyGraph/W=NWRgraph userticks(bottom)={angle_ticklocator,angle_ticklabel}
ModifyImage/W=NWRgraph MxToPlot ctab= {*,*,Rainbow,1}
ModifyGraph/W=NWRgraph axisEnab(bottom)={0,0.9}
ModifyGraph/W=NWRgraph fStyle(bottom)=1,fSize(bottom)=14,fStyle(left)=1,fSize(left)=14
//ColorScale/W=NWR_graph/C/N=cb_NWR/F=0/A=RC/X=-9.61/Y=0.51 heightPct=110,image=MxToPlot
//ColorScale/W=NWR_graph/C/N=cb_NWR "concentration"
SetScale/P y 0,Radial_res,"Wind speed (km/h)", MxToPlot
End Function
I don't get any errors if I do it all manually, so I'm probably missing something....
thanks for your help!
I think it's because ModifyImage expects a name of a wave but you are providing a wave reference. I know two ways around it, maybe there are others:
wave w // image w
display/K=1
AppendImage w
// (1) provide a name using $string
ModifyImage $NameOfWave(w), ctab= {*,*,Rainbow,1}
// (2) use of two single quotes for the displayed matrix
ModifyImage ''#0, ctab= {*,*,Rainbow,1}
end
April 10, 2015 at 03:52 am - Permalink
April 10, 2015 at 05:33 am - Permalink
That's not quite right.
You can use a wave reference wherever Igor expects a wave name. However ModifyImage does not expect a wave name - it expects an image name. To understand the difference, execute this:
AppendImage/L=left/B=bottom0 mat
ModifyGraph axisEnab(bottom0)={0,0.45}
AppendImage/L=left/B=bottom1 mat
ModifyGraph axisEnab(bottom1)={0.55,1.00}
ModifyImage mat#1 ctab= {*,*,Rainbow,0}
This creates a graph with two images, mat and mat#1. mat is equivalent to mat#0.
This is analogous to the difference between wave names and trace names, which is explained here:
April 10, 2015 at 07:12 pm - Permalink
Thanks for clarifying!
April 11, 2015 at 02:43 am - Permalink