Filled colur in contour plot

Hi,
I want to ask about how to change the apperaence of the contour like the attached image rather than representing with lines.

Thanks
The image you attach looks like a straightforward image plot with a color table applied (i.e. a monochrome image with false coloring). In that case there seems to be little reason to bother with contouring. You can just display the 2D wave as an image (using NewImage or Display; AppendImage) and modify the color scaling using "modify image appearance" by right-clicking on the graph.

For upsampling the image you could take a look at ImageInterpolate.

Of course, this assumes that your data is present in a 2D wave, or as different layers of a 3D wave. What format is your data in?
I use XYZ waves to plot the contour plot.
And it look likes attachment CP01 but I would like to make it like the other attachment.
Thanks
Untitled.jpg (0 bytes) CP01.jpg (70.19 KB)
Fortress wrote:
I use XYZ waves to plot the contour plot.


In that case I would probably create an interpolated matrix (2D wave) from the triplet wave, and display that matrix as a regular image. I believe that the ImageInterpolate operation should be up to the task. See the help for ImageInterpolate, and specifically the "Voronoi" keyword.

Note that this operation requires a single triplet wave (a Nx3 wave). If your data is currently in three separate waves then you can use the Concatenate operation to create a single triplet wave.

Once you have the interpolated matrix you can display and modify it just like any monochrome image.
Fortress wrote:
I use XYZ waves to plot the contour plot.
And it look likes attachment CP01 but I would like to make it like the other attachment.
Thanks

Pretty often gridded data is saved as XYZ triplets even when they don't need to be. Do your XY values fall on a regular grid? If so, there are techniques in Igor to "fold" your Z values into a gridded matrix without having to do interpolation.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
Does it use the following to concatanate operation?
"Example: Concatenating Waves
Concatenating waves can be done much more easily using the Concatenate operation (see page V‐56). This
simple example serves mainly to illustrate a use of wave assignments.
Suppose we have three waves of 100 points each: wave1, wave2 and wave3. We want to create a fourth wave,
wave4, which is the concatenation of the three original waves. Here is the sequence of commands to do this.
Make/N=300 wave4
wave4[0,99] = wave1[p] // set first third of wave4
wave4[100,199] = wave2[p-100] // set second third of wave4
wave4[200,299] = wave3[p-200] // set last third of wave4"

or using other method?
As I cannot get how to concatenate waves
Thanks
Fortress wrote:
As I cannot get how to concatenate waves


The purpose of the concatenation is not to get a wave that is three times as long as the original waves, but rather the same length but with three different columns (a 2D wave).

In this case the name "Concatenate" is slightly misleading, even though it is implemented in the operation:
Igor Manual wrote:
By default the concatenation increases the dimensionality of the destination wave if possible. For example, if you concatenate two 1D waves of the same length you get a 2D wave with two columns. The destination wave is said to be "promoted" to a higher dimensionality.


So if you have three waves, say wave1, wave2, and wave3, that all have the same length, the the command to execute is
Concatenate {wave1, wave2, wave3}, myTripletWave


The resulting wave, myTripletWave, can then be used in ImageInterpolate Voronoi. But, as John suggested, if your data is regularly spaced to start from then the use of ImageInterpolate can be avoided.
johnweeks wrote:
Fortress wrote:
I use XYZ waves to plot the contour plot.
And it look likes attachment CP01 but I would like to make it like the other attachment.
Thanks

Pretty often gridded data is saved as XYZ triplets even when they don't need to be. Do your XY values fall on a regular grid? If so, there are techniques in Igor to "fold" your Z values into a gridded matrix without having to do interpolation.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com


My X, Y and Z are singular wave only,
can it "fold"?
Thanks
For using this command
"ImageInterpolate/PTW=W_TriangulationData Voronoi my1DZWave"
I just type
"ImageInterpolate/PTW=plot_01 Voronoi draw01"
as draw01 for the new wave,
but it says "expected wave name"
What does it mean?

PS: I use "Concatenate/O {x_a_40k,z_a_40k,Max_T},plot_01" for coocatenate the N x 3 wave
The /PTW flag stands for Previous Triangulation Wave, something that at this point you don't appear to have. As others have indicated you need to follow these steps:

1. Concatenate your 1D waves into a single triplet wave as in:
Concatenate {xwave,ywave,zwave}, myTripletWave

This is a triplet wave and it is NOT a triangulation wave. If you want to find out more about triangulation you might want to look up this link: http://en.wikipedia.org/wiki/Delaunay_triangulation

2. Estimate the range of your data in the X and Y directions. You can do that using:
Variable xmin=WaveMin(xWave)
Variable xmax=WaveMax(xWave)
and similarly for Y.

3. Decide on your increments in the X and Y directions, e.g.,
Variable dx=(xmax-xmin)/50
and similarly for dy.

4. Run ImageInterpolate using the syntax:
ImageInterpolate/S={xmin,dx,xmax,ymin,dy,ymax} voronoi myTripletWave

This will create for you the wave M_InterpolatedImage in the current data folder. You can display this image using false color or other options.

Some of this is covered also in the video tutorial "Creating a Surface Plot from Scatter Data" that you can find here: http://www.wavemetrics.com/products/igorpro/videotutorials.htm

I hope this helps,

A.G.
WaveMetrics, Inc.
Igor wrote:
The /PTW flag stands for Previous Triangulation Wave, something that at this point you don't appear to have. As others have indicated you need to follow these steps:

1. Concatenate your 1D waves into a single triplet wave as in:
Concatenate {xwave,ywave,zwave}, myTripletWave

This is a triplet wave and it is NOT a triangulation wave. If you want to find out more about triangulation you might want to look up this link: http://en.wikipedia.org/wiki/Delaunay_triangulation

2. Estimate the range of your data in the X and Y directions. You can do that using:
Variable xmin=WaveMin(xWave)
Variable xmax=WaveMax(xWave)
and similarly for Y.

3. Decide on your increments in the X and Y directions, e.g.,
Variable dx=(xmax-xmin)/50
and similarly for dy.

4. Run ImageInterpolate using the syntax:
ImageInterpolate/S={xmin,dx,xmax,ymin,dy,ymax} voronoi myTripletWave

This will create for you the wave M_InterpolatedImage in the current data folder. You can display this image using false color or other options.

Some of this is covered also in the video tutorial "Creating a Surface Plot from Scatter Data" that you can find here: http://www.wavemetrics.com/products/igorpro/videotutorials.htm

I hope this helps,

A.G.
WaveMetrics, Inc.


I follow the step and it shows error until step 4
I type "ImageInterpolate/S={xmin,dx,xmax,ymin2,dy,ymax2} voronoi myTripletWave"
and it says
"Use '/N=number' or '/N=(expression)' (assuming flag 'N'). If multiple dimensions used (i.e., Make/N), use /N=(n1,n2...)"
and "xmin" is highlighted as the error.
what should I do?

Thanks
Quote:
it says "Use '/N=number' . . ."

This looks like a bug in the parsing of the ImageInterpolate /S flag. You can work around it by putting each of the /S parameters in parentheses.

This problem applies to ImageInterpolate /S when interpreted (from the command line or in a macro) but not when compiled (in a user-defined function).
hrodstein wrote:
Quote:
it says "Use '/N=number' . . ."

This looks like a bug in the parsing of the ImageInterpolate /S flag. You can work around it by putting each of the /S parameters in parentheses.

This problem applies to ImageInterpolate /S when interpreted (from the command line or in a macro) but not when compiled (in a user-defined function).


I solve the problem now and I get the image by using ImagePlot.
However, my image has some white point.
Does it have any method to clear the point?

P.S. I dont have those white points if I plot a 3D surface
Graph1.jpg (239.22 KB)
JimProuty wrote:
With your contour plot the frontmost window, choose Graph->Packages->Append Image or Fill Between Contours.

Done.

--Jim Prouty
Software Engineer, WaveMetrics, Inc.


Thank you Jim, although you posted your statement some years ago.

This "Fill Between Contours" function is basically what I want to do, and should be mentioned in chapter II-14 of the Manual.

But why is this so extremely slow? I am surprised about this, since the contours are already calculated and all this function has to do is filling between the lines.

And how are the commands to implement this filling into a macro?

Best, hea
Igor 7 (just released) can fill contours using the lines. The algorithm isn't perfect, and sometimes one needs to fall back on the "sliced image" approach provided by the procedures.

The newer procedures in Igor 7 and Igor 6.37 use a Panel with more control than the primitive dialog in my old example.

See Igor's Graphs->Packages->Fill Between Contours menu.

--Jim Prouty
Software Engineer, WaveMetrics, Inc.
This sounds promising, thank you.

However, by now I am using Igor Pro 6.3.6.4 and can not immediately change this since this is the only version being available in our institution.

The "Fill between contours" panel is already more detailed (see attachment) than the one you provided in 2013 but I don't know how it would look like in 6.37 or later.
And I don't know how to implement this into my procedure (I wrote some code to collect data and establish the diagrams).

I have three separate 1D waves containing non-gridded X, Y, and Z data. The Y and Z dimensions should be represented in a log scale.

The contour function does a good job, but the space between the lines is not filled. Actually, I would make the lines transparent or set the line thickness to zero and just use the filled area in my diagrams (obviously a stepless representation would be ideal but with a sufficient number of contours the "Z-resolution" becomes OK).

To get a nice color map, I tried to follow the way described in the sub-chapter "Plotting 1D X, Y and Z Waves With Non-Gridded XY Data" in the manual (pages II-356 and 357 in the Igor Pro 6.36 manual):
I used "Concatenate" to create a triplet Wave, and the described Voronoi interpolation.

Your stated "sliced image approach provided by the procedures" seems to be something else. Could explain a little more detailed how I should proceed?

Best, hea.
fill_dialog.png (13.95 KB)
What is the source data? A matrix? If so, create an image plot and adjust the color table accordingly.

If some form of xyz data, you have a few options:

The Graph->Packages->Fill Between Contours can create an image, optionally "flat" between contour levels, or like your example image, a continuous interpolated image.

Then set the contour line widths to zero.
hea wrote:
This sounds promising, thank you.
I have three separate 1D waves containing non-gridded X, Y, and Z data. The Y and Z dimensions should be represented in a log scale.

The contour function does a good job, but the space between the lines is not filled. Actually, I would make the lines transparent or set the line thickness to zero and just use the filled area in my diagrams (obviously a stepless representation would be ideal but with a sufficient number of contours the "Z-resolution" becomes OK).

To get a nice color map, I tried to follow the way described in the sub-chapter "Plotting 1D X, Y and Z Waves With Non-Gridded XY Data" in the manual (pages II-356 and 357 in the Igor Pro 6.36 manual):
I used "Concatenate" to create a triplet Wave, and the described Voronoi interpolation.

Your stated "sliced image approach provided by the procedures" seems to be something else. Could explain a little more detailed how I should proceed?

Best, hea.


The "sliced image approach" is just the "flat" option provided in Graph->Packages->Fill Between Contours, which uses the ContourZ function for XYZ contour data or the ImageInterpolate operation for matrix data.

The match between the image and contours is improved when the contour lines are interpolated x256.

--Jim Prouty
Software Engineer, WaveMetrics, Inc.
I think I am happy (for the moment) with the "fill between contours" function for the moment, especially since the colors can be log scaled (unlike the contours as I found so far).

On a longer term perspective we will probably update to Igor 7.

But how can I implement this "Fill between Contours" function in my code? Is there a command? I could not find it in the manuals by myself.

Edit (2016-08-21):
Meanwhile I understand that you tried to explain that I should use the ContourZ or the ImageInterpolate functions to create a matrix which can then be displayed as an image in the contour diagram. Sorry that I did not get it right after reading your post for the first time.

Anyway I would not know which method to select to do the same as the "Fill between contours" dialog.

And I noticed that an additional line has been automatically added to my procedure window since I used the "Graph"-"Packages"-"Fill between contours" dialog:
#include ,menus=0

Since this item (is it a procedure, how to call that thing which is "included"?) is now included, shouldn't I be able to execute it using a specific command? I tried both to execute this command in the command window and to include it in my procedure - without success.