image plot with different y basis.

Jinhyung Kim
Posts: 26
Joined: 2014-01-02
Location: South Korea

I have a question about image plot.
I have z data depending on y for a certain wavelength.
wavelengths are evenly spaced, However, y is not equal and not evenly spaced.

For example,

wavelength1
y1=1
y2=4
y3=6.214
y4=10.112
.
.
wavelength2
y1=4
y2=7.5
y3=11.8481
y4=14.05
.
.

wavelength3
y1=12.02
y2=16
y3=18.1192
y4=21.8221
.
.

(here, the z values are skipped)

I want to image plot of z distribution with wavelength of bottom axis and y distribution of left axis.
(Due to the data range of y, there are blank part in final image)

I searched the forum and manual but I can't find the right way about this.
Is it possible in Igor pro ?
I'm using 6.37 version.

Thanks in advance.


[ last edited April 5, 2018 - 18:33 ]
olelytken
Posts: 72
Joined: 2015-10-12
Location: Germany

If your y-values were the same for all x-values you could simply plot your images using x- and y-waves AppendImage/W=$ActiveWindow RawDataWave vs {XWave, YWave}, but in your case they are not. The only solution I can see is to interpolate your data into evenly spaced pixels and plot it normally.


Igor's picture
Posts: 805
Joined: 2007-06-29
Location: United States

It seems to me that a good representation of this type of data could be in a Gizmo plot. You may even be able to get satisfactory results with IP 6.37 but IP7 is recommended. The general approach is to format your data as triplet waves. A triplet wave is a 2D wave with 3 columns (for x, y, z). You would then assign the wavelength to the first column, the y data to the second column and the z data to the third column. Create as many such waves as are necessary and then plot them in Gizmo as path objects.

If you really want to display this data as an image as opposed to a 3D graph, check the documentation for AppendImageFromXYZ.

A.G.
WaveMetrics, Inc.


Jinhyung Kim
Posts: 26
Joined: 2014-01-02
Location: South Korea

Thank you for replies.

As you suggested, I'm trying to use Gizmo path.
I made a short macro code to add triplet waves in gizmo
However, there's a problem
When I execute the below macro, there's an error message

"Unknown object"
ModifyGizmo modifyObject=$("tri"+num2str(k)), property{pathcolortype,3}

the word "property" is highlighted.

How can I fix it?

Thank you.

Macro addPath()
	variable i=0
	variable k
	string property
	do
	k=600+2*i
	appendtogizmo/d path=$("tri"+num2str(k))
	modifyGizmo modifyObject=$("tri"+num2str(k)), property{pathcolortype,3}
	i+=1
	while(i<=10)
end


s.r.chinn
Posts: 345
Joined: 2007-08-16
Location: United States

I believe you need an equal sign in property={pathcolortype, 3}
See

displayhelptopic "ModifyGizmo for Path Objects"


Jinhyung Kim
Posts: 26
Joined: 2014-01-02
Location: South Korea

I'm sorry. I missed the sign.
After I put the equal sign in that position,
the error message also appear and the equal sign is highlighted.
I attached screenshot.

Thank you

AttachmentSize
2018-04-12 02.16.20.png49.61 KB

[ last edited April 11, 2018 - 09:32 ]
s.r.chinn
Posts: 345
Joined: 2007-08-16
Location: United States

property is not a string, but part of the ModifyGizmo command syntax. Remove the string definition from your code.


Jinhyung Kim
Posts: 26
Joined: 2014-01-02
Location: South Korea

I deleted the string line part.
but the same error is appear as I attached the screen shot.

Thank you

AttachmentSize
2018-04-12 02.27.13.png65.01 KB

s.r.chinn
Posts: 345
Joined: 2007-08-16
Location: United States

ModifyGizmo modifyObject=objName, objectType=path, property={propertyName,data}
I missed seeing that you omitted the objectType qualifier in the command.


Jinhyung Kim
Posts: 26
Joined: 2014-01-02
Location: South Korea

It also shows same error.. I'm sorry.
I attached screen shot.
please advise me.
Thank you.

AttachmentSize
2018-04-12 20.13.42.png103.44 KB

s.r.chinn
Posts: 345
Joined: 2007-08-16
Location: United States

I hardly ever use Macros for this type of problem. Why are you not using a Function? There are other problems with your code, including wave references and path objects. Please post a minimum sized set of y, wavelength, and z data. Save and attach your data file(s) to your response.
displayhelptopic "Save"


s.r.chinn
Posts: 345
Joined: 2007-08-16
Location: United States

For lack of posted data, I have made up my own and tested the following example:

function fAddPaths()
	wave wave0, wave1, wave2  //  these are triplet waves for each path constructed before the function is called.
	variable ii
	for(ii=0;ii<3;ii+=1)
		AppendToGizmo/D  path =  $("wave"+num2str(ii))
		ModifyGizmo ModifyObject=$("path"+num2str(ii)),objectType=path,property={ drawTube, 1}
		ModifyGizmo ModifyObject=$("path"+num2str(ii)),objectType=path,property={ fixedRadius,0.001*(1+ii)}
	endfor
end

In this example, I have varied the path's thicknesses using tube-mode radius. WARNING: this example was tested in Igor Pro 7, and will not work in Igor Pro 6. You will need a different means of distinguishing path appearances. Most importantly, in IP6 each Gizmo command in the function will have to be converted to a string (appropriate for the specific 'ii' value) and then executed using the Execute operation; in a Macro, For-Endfor must change to Do - While. You might be able to use a macro rather than a function if you can figure out how to get the path waves into the macro. I strongly encourage upgrading to IP7 and using a function.


[ last edited April 12, 2018 - 08:07 ]
Jinhyung Kim
Posts: 26
Joined: 2014-01-02
Location: South Korea

Thank you for the explanation and the code.
I'm using macro to use ModifyGizmo because the ModifyGizmo is not supported in a function in Igor 6 as you mentioned.
So the function you made is not work in my mac, I'm sorry.

After many trials, I resolved the problem with below code.
Actually, I'm not expert in coding, the code is not well written but it works anyway.

Thank you for kind replies and helping me.

Macro addPath()
	variable i=0
	variable k
	do
	k=600+2*i
	appendtogizmo/d path=$("tri"+num2str(k)), name=$("tri"+num2str(k))
	ModifyGizmo modifyObject=$("tri"+num2str(k)), property = {pathColortype,3}, property = {pathCtab,rainbow}
	ModifyGizmo modifyObject=$("tri"+num2str(k)), property = {InverseCtab,1}
	i+=1
	while(i<=100)
end


[ last edited April 13, 2018 - 02:13 ]

Back to top