Subscribe Bookmark RSS Feed

Help with Categorical Color Theme Script in Graph Builder (Black to Gray)


Community Trekker


Jun 4, 2015

Hi all,

I have a script that creates several plots as output. One graph is a stacked proportion plot and I am trying to get the color theme on it to match another plot (which is based on a continuous gradient color theme that goes from Black to light gray). The data table used for this graph has three columns: an index column, a category column, and a proportion column. The "Category Column" has values that range from 1 to some integer (so the number of levels in this column could change and is data-table dependent).


This is the script I'm using:


Graph Builder( Show Control Panel( 0 ), 
	Categorical Color Theme(  {"White to Black Copy", 2051, {"Black", {221, 221, 221}}} ), 
		X( :Index, Order By( :Proportion, Descending, Order Statistic( "N" ) ) ),  
		Y( :Proportion ), 
		Overlay( :Category ) ), 
	Elements( Bar( X, Y, Legend( 2 ), Bar Style( "Stacked" ) ) ),
		Dispatch( {}, "Proportion", ScaleBox, {Max( 1.02 )} ),  
		Dispatch( {}, "X title", TextEditBox, {Set Text( "Index" )}) 

So rows with category at level "1" should be black and then get progressively lighter for the next levels. However, when I create the plot, the level 1 boxes are always a few shades lighter than black:


Any ideas how to fix or why it does this? I realize this isn't a huge deal in the long run, but am curious why the script does this.


Thanks much.






Jun 23, 2011

When using a continuous color theme for categorical colors, each category covers a range of colors and JMP picks the last color in the range to represent that category. That rule works well for the built-in color themes that go from light to dark. Since your color theme goes from dark to light, the last color each each range will be the lightest.

To avoid that you could reverse the color theme or mark the color theme as qualitative in the color theme editor with a specific number of levels.