Create a color RGBA wave

Hello,

I am doing a 3D scatter plot and I want each marker to be colored different. I tried to create a wave using the RGBA (according with other post), the new wave should have the same number of rows as my triplet wave. I am sure my problem is the way I am coding the RGBA wave, because when I use the function:
ModifyGizmo makeTripletColorWave = {your1DWave, ctabName, 0 }

a windows display:
Wave type error

Could you please help me or guide me on how to create a RGBA wave and used to color a 3D scatterplot.

Thank you so much

Liza
I think RGBA waves should be a 4-column wave and not a 3-column wave. This could be the problem. RGBA should be red, green, blue and alpha values in columns 0,1,2,3. I think they're on a scale of 0 to 1, IIRC. To make one you can concatenate 4 1D waves of the same length (the number of points in your plot). Maybe try:
Variable n=numpnts(yourwave)
Make /N=(n) rw,gw,bw,aw
rw=x
rw/=n
gw=0
bw=0
aw=1
concatenate {rw,gw,bw,aw}, rgbaw

This will make them black to red in order.
Hello Lisa,
y
You can try the method described above but ou can also use Gizmo to create a color wave directly from any one of the built-in color tables using the command
ModifyGizmo makeTripletColorWave = {your1DWave, ctabName, 0 }

Here your1DWave is any 1D scalar wave that has the same number of points as your scatter markers and ctabName is a name of a built-in color table. Here is a full example:
// create scatter markers
make/n=(33,3) ddd=gnoise(10)
•NewGizmo; ModifyGizmo ShowInfo
•AppendToGizmo DefaultScatter=root:ddd
// create a sample 1D scalar wave with simple linear variation.
make/n=33 eee=x  
ModifyGizmo makeTripletColorWave = {eee, rainbow, 0 }


At this point you return to the scatter dialog and assign the color wave (eee_C) to the scatter object.

I hope this helps,

A.G.
WaveMetrics, Inc.
Thank you for your response, but I forgot to mention that I am new using Igor, so I got lost.
What is the 1D scalar wave that has the same number of points as your scatter markers?
How can I get the ctabName is a name of a built-in color table?

Do you think is possible to go a little bit more specific and step by step?

Thank you so much

Liza







Igor wrote:
Hello Lisa,
y
You can try the method described above but ou can also use Gizmo to create a color wave directly from any one of the built-in color tables using the command
ModifyGizmo makeTripletColorWave = {your1DWave, ctabName, 0 }

Here your1DWave is any 1D scalar wave that has the same number of points as your scatter markers and ctabName is a name of a built-in color table. Here is a full example:
// create scatter markers
make/n=(33,3) ddd=gnoise(10)
•NewGizmo; ModifyGizmo ShowInfo
•AppendToGizmo DefaultScatter=root:ddd
// create a sample 1D scalar wave with simple linear variation.
make/n=33 eee=x  
ModifyGizmo makeTripletColorWave = {eee, rainbow, 0 }


At this point you return to the scatter dialog and assign the color wave (eee_C) to the scatter object.

I hope this helps,

A.G.
WaveMetrics, Inc.

Ldaglio
ldaglio wrote:
Thank you for your response, but I forgot to mention that I am new using Igor, so I got lost.
What is the 1D scalar wave that has the same number of points as your scatter markers?
How can I get the ctabName is a name of a built-in color table?


Hi Liza,

The 1D scalar wave is a 1 dim matrix. In AG's example that is the line:

make/n=33 eee = x

/n=33 sets the number of rows in the wave. Make this equal to the number of rows in the data wave you are plotting in Gizmo. Incidentally, this could have any name, such as "MyColorWave" instead of "eee".

The "= x " part sets the contents of the new wave to values from 0 to the number of points in the wave less one. So for /n=33, the first row stores the value 0, second stores 1, .... last row stores 32. Just a simple linear progression. The function that creates the color wave will map the color table according to the values stored in this wave. So if the values are linear, the spacing of the color values will be linear, if the values are logarithmic, the color values will be logarithmic.

The names of the built in color tables are the same as you see in any dialog where you select a color table. For example, in the Gizmo info dialog box, if you right click your data wave and select edit item you will see a radio button labeled "color table" with an associated drop down box. You can use any entry in that list for a color table name. Also, on the command line, you could execute print ctablist() to get a list of built in color tables.

If you execute on the command line

make/n=100 MyColorWave=x  //change "100" to the appropriate value for your data wave
ModifyGizmo makeTripletColorWave = {MyColorWave, mud, 0 }


A new wave called "MyColorWave_C" will be created in the current data folder using the Mud built in color table. Finally, using the Gizmo Info dialog, right click on the name of your displayed wave in display list and select Edit Item from the context menu. Then, in the section labeled "Marker Color" select the radio button labeled "Color Wave" and select "MyColorWave_C" from the drop down list. Then click the OK button and your scatter plot markers will have the new color wave applied to them.

Hope this helps.

By the way, you may want to play with the values of MyColorWave to manipulate the spacing of colors in MyColorWave_C.

Hello jtigor,

Thank you so much, your explanation was very very helpful, I am able now to color the plot. The only thing that I am missing is to plot each point with a different color. I have the 100 rows, so for example I want the first 10 to be the red, then the other 20 blue, 20 green, 40 yellow, last 10 orange.
How can I define this in my wave?

Thanks again in advance for your time.

Liza
ldaglio wrote:
The only thing that I am missing is to plot each point with a different color. I have the 100 rows, so for example I want the first 10 to be the red, then the other 20 blue, 20 green, 40 yellow, last 10 orange.
How can I define this in my wave?


Enter the following into the command line and execute:
•MyColorTable[0,9]=1000 //red
•MyColorTable[10,29]=0 //blue
•MyColorTable[30,49]=600 //green
•MyColorTable[50,89]=750 //yellow
•MyColorTable[90,99]=900 //orange
•ModifyGizmo makeTripletColorWave = {MyColorTable, rainbow, 1 }
Edit MyColorTable
AppendToTable MyColorTable_C


This will create a color wave (MyColorTable_C) such that the first 10 points in your data wave will be colored red, the next 20 points colored blue(ish), the next 20 points colored green(ish), the next 40 points colored yellow and the last 10 points colored orange(ish). If this isn't quite what you need, for example if you want the first 10 points to be shades of red, then you'll need to play with the contents of MyColorTable. Note that range of 0 to 1000 isn't necessary. You may find that changing this range better suites your goal. If you think about what is being done in the example, you should be able to proceed from this point on.

Maybe AG or someone else has additional advice on crafting a color table.

jtigor wrote:
ldaglio wrote:
The only thing that I am missing is to plot each point with a different color. I have the 100 rows, so for example I want the first 10 to be the red, then the other 20 blue, 20 green, 40 yellow, last 10 orange.
How can I define this in my wave?


Enter the following into the command line and execute:
•MyColorTable[0,9]=1000 //red
•MyColorTable[10,29]=0 //blue
•MyColorTable[30,49]=600 //green
•MyColorTable[50,89]=750 //yellow
•MyColorTable[90,99]=900 //orange
•ModifyGizmo makeTripletColorWave = {MyColorTable, rainbow, 1 }
Edit MyColorTable
AppendToTable MyColorTable_C


Hello Tjigor,

Thank you so much for your help, I also found another way to color each marker in the plot, using the data/packages/colorwave then you select the color wave I create and I can modified each point.

Cheers

Liza




This will create a color wave (MyColorTable_C) such that the first 10 points in your data wave will be colored red, the next 20 points colored blue(ish), the next 20 points colored green(ish), the next 40 points colored yellow and the last 10 points colored orange(ish). If this isn't quite what you need, for example if you want the first 10 points to be shades of red, then you'll need to play with the contents of MyColorTable. Note that range of 0 to 1000 isn't necessary. You may find that changing this range better suites your goal. If you think about what is being done in the example, you should be able to proceed from this point on.

Maybe AG or someone else has additional advice on crafting a color table.

Ldaglio