cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
EliPet
Level I

How to build RGB colorscale as color theme for Graph Builder

Hi,

I am analyzing some data through a script. In particular, I have three variables, namely A, B and C, and they represent three properties of a picture. To plot the picture in function of these three properties, I'm used to color the different rows using the Row State property:

 

For each row( dt,

Color Of() = RGB Color(:A, :B, :C) );

 

In this way, each point/row has a RGB color 1:1 matching the values of the three variables.

I'm trying to plot the picture with the Graph Builder and to put in its Color option this specific RGB colorcode, because I had in the subsequent code to clear the Row States. In particular, col and row are the coordinates of my picture and RGB is a new column I had created with the formula: Color Of() = RGB Color(:A, :B, :C);  

 

Map = dt << Graph Builder(
Show Control Panel( 0 ),
Variables( X( :col ), Y( :row ), Color(:RGB) ),
Elements( Points( X, Y, Legend( 4 ) ) )
) ;

 

The problem is that GB consider the column RGB as a column of values not as a column of decoded colors. 

 

Any idea to convert that RGB colorcode I'm used to in a color theme for GB?

Thanks!

2 REPLIES 2

Re: How to build RGB colorscale as color theme for Graph Builder

You might not need a new color theme. Graph Builder honors the color row state, so you only need to change this row state. Here is an example that plots RunPulse against RstPulse. The color row state is first set based on three other normalized (0,1) variables.

 

Names Default to Here( 1 );

dt = Open( "$SAMPLE_DATA/Fitness.jmp" );

For Each Row(
	Row State() = Color State( {
		:Oxy / Col Max( :Oxy ),
		:Runtime / Col Max( :Runtime ),
		:Weight / Col Max( :Weight )
	} );
);

dt << Graph Builder(
	Size( 528, 450 ),
	Show Control Panel( 0 ),
	Variables( X( :MaxPulse ), Y( :RunPulse ) ),
	Elements( Points( X, Y, Legend( 3 ) ) )
);
Byron_JMP
Staff

Re: How to build RGB colorscale as color theme for Graph Builder

That's a stumper.  I tried to build a new color theme but it didn't work very well. 

 

I made a table with 1000 random RGB values. (script at the bottom)

The RGB values are converted to JMP color.

Then I deleted the formulas, and sorted the columns by the JMP color.

and added a formula to generate some text to use in a new color theme.

 

I used the one of the existing color themes as a template. From a script window, run: Get Preferences(); and grab one of the color themes, like this one.

	Add Color Theme(
		{"Reverse Jet", 2051, {{127, 0, 0}, {255, 0, 0}, {255, 127, 0}, {255, 255, 0}, {127, 255,
		127}, {0, 255, 255}, {0, 127, 255}, {0, 0, 255}, {0, 0, 127}, Missing( "Black" )}, 1, 1}
	),

I gave the new theme a new name and replaced the sets of three item lists with the text from the table.

I don't know what the initial 2051 does, and I don't know what the last "1, 1" does either. So I just kept those.

 

Go back to the script window where you ran Get Preferences, delete the script, copy the entire log and paste it back into the window.

Delete the comments at the beginning and change the first argument from "Preferences" to Set Preferences.

At the very end add, your new color theme. Make sure its following the format of the preferences, commas and inside the last paren.. stuff like that.

 

As an after though, it might be a good idea to save your preferences script before the edit, so you can get it back later.

 

After you run the set preferences script, the new color theme should show up as an option in graph builder, no need to restart JMP.

 

Note, this the new color theme is enormous, looks interesting but not quite right, and it makes graph builder grindingly slow.

 

New Table( "maker",
	Add Rows( 1000 ),
	New Script(
		"Scatterplot 3D",
		Scatterplot 3D(
			Y( :R, :G, :B ),
			Frame3D(
				Set Grab Handles( 0 ),
				Set Rotation( 127.28221594942, -1.35536871654718, 146.077602393409 ),
				Set Marker Scale( 3.8125 )
			)
		)
	),
	New Column( "R",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Formula( Random Integer( 0, 255 ) ),
		Set Selected
	),
	New Column( "G",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Formula( Random Integer( 0, 255 ) ),
		Set Selected
	),
	New Column( "B",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Formula( Random Integer( 0, 255 ) ),
		Set Selected
	),
	New Column( "Column 4",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Formula( Color Of() = RGB Color( :R, :G, :B ) ),
		Set Selected
	)
)

 

 

 

 

JMP Systems Engineer, Health and Life Sciences (Pharma)