cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Get the free JMP Student Edition for qualified students and instructors at degree granting institutions.
Choose Language Hide Translation Bar
View Original Published Thread

Customise value colours in columns

matth1
Level IV

I have a numeric column called Rejects which is set to be nominal. Most of the values are zero but there are also a range of values from 1 to N (N being variable depending on the dataset). I use these to plot a map of reject locations with the number of rejects indicated by colour.

 

I would like take advantage of the JMP built-in chromatic colour themes but with any value of 0 shown in light grey (so it's easy to see where there are rejects). However, I can't do both.

 

I tried:

dt:Rejects << Set Property( "Value Colors", Color Theme( "Jet" ) );
dt:Rejects << Set Property( "Value Colors", {0 = 32} );

but the second command overrides the first and sets the color theme back to the default. I can do it interactively by setting the colour theme then clicking on the colour for 0 in the column properties dialog but I want to script it.

 

I could change the default catagorical colour threme to be Jet, but I don't want to rely on that, and I also just other colour themes elsewhere in my reports. I also don't want to hardcode the colours because I want to use the full range of colours (blue to red) whether N is 5 or 25.

 

Many thanks for your help,

 

Matthew.

 

1 ACCEPTED SOLUTION

Accepted Solutions
ian_jmp
Level X


Re: Customise value colours in columns

Something like this, perhaps?

NamesDefaultToHere(1);

// Make a table with defect counts
dt = NewTable("Defects", NewColumn("Rejects", Numeric, Ordinal, Formula(RandomInteger(0, 5))));
dt << addRows(30);
dt << runFormulas;
// Set some default colours . . .
dt:Rejects << Set Property( "Value Colors", Color Theme( "Jet" ) );
// Make a graph
gb = dt << Graph Builder(
				Size( 529, 447 ),
				Show Control Panel( 0 ),
				Variables( X( :Rejects ), Color( :Rejects ) ),
				Elements( Bar( X, Legend( 5 ) ) )
			);
// Get the default colors
defaultColours = dt:Rejects << getProperty("Value Colors");
// Update the colour for 0 defects
Wait(2);
defaultColours[1] = Expr(0 = 32);
// Renistate updated colours
dt:Rejects << Set Property( "Value Colors", defaultColours);

View solution in original post

2 REPLIES 2
ian_jmp
Level X


Re: Customise value colours in columns

Something like this, perhaps?

NamesDefaultToHere(1);

// Make a table with defect counts
dt = NewTable("Defects", NewColumn("Rejects", Numeric, Ordinal, Formula(RandomInteger(0, 5))));
dt << addRows(30);
dt << runFormulas;
// Set some default colours . . .
dt:Rejects << Set Property( "Value Colors", Color Theme( "Jet" ) );
// Make a graph
gb = dt << Graph Builder(
				Size( 529, 447 ),
				Show Control Panel( 0 ),
				Variables( X( :Rejects ), Color( :Rejects ) ),
				Elements( Bar( X, Legend( 5 ) ) )
			);
// Get the default colors
defaultColours = dt:Rejects << getProperty("Value Colors");
// Update the colour for 0 defects
Wait(2);
defaultColours[1] = Expr(0 = 32);
// Renistate updated colours
dt:Rejects << Set Property( "Value Colors", defaultColours);
matth1
Level IV


Re: Customise value colours in columns

Thanks Ian, works well!

 

Regards,

Matthew.