Choose Language Hide Translation Bar
vince_faller
Super User

shapeseg() color by average value

I'm trying to color a shapeseg by the average of the contents of its row states (think graph builder).  If there are two contrasting values in the row states, it just doesn't color it however.  

Has anyone every had any luck doing this?

 

Names default to here(1);

dt = open("$SAMPLE_DATA\Big Class.jmp");
ss = Shape Seg(
	{Path( [10 10 1, 10 70 0, 70 70 0, 70 10 -3] ),
		Path( "M20,20 C20,60 60,60 60,20 Z" ), 
		Path( [10 60 1, 10 90 0, 70 90 0, 70 60 -3] )
	},

	RowStates(dt, 
		{
			{1, 2}, // two different ones so it's not colored
			{3}, // only one color so it colors 
			{7,10, 16} //three of the same color so it colors
		}
	)
);
New Window( "Shape Seg Example",
	gb = Graph Box()
);
gb << append Seg(ss);
Vince Faller - Predictum
0 Kudos
5 REPLIES 5
Highlighted
mikedriscoll
Community Trekker

Re: shapeseg() color by average value

Can you clarify a couple things? The list of lists in rowstates(dt, {list of lists}) refers to row numbers, with each sub-list associated with each respective path above, and when I run your script I don't get any colors. If I try to color them manually, by right-clicking on the segments after they're drawn, I can do so, and the associated rows in the table are colored.

 

Can you elaborate on what you mean, color by average of the contents of its row states? In this example it would appear you'd want to color by average of row number, but maybe I'm misunderstanding.  How are you trying to create the coloring?

0 Kudos
Highlighted
vince_faller
Super User

Re: shapeseg() color by average value

My apologies, I forgot to color by column.  

 

Names default to here(1);

dt = open("$SAMPLE_DATA\Big Class.jmp");
dt << Color By Column(:height, Color Theme("Spectral"));
ss = Shape Seg(
	{Path( [10 10 1, 10 70 0, 70 70 0, 70 10 -3] ),
		Path( "M20,20 C20,60 60,60 60,20 Z" ), 
		Path( [10 60 1, 10 90 0, 70 90 0, 70 60 -3] )
	},

	RowStates(dt, 
		{
			{1, 2}, // two different ones so it's not colored
			{3}, // only one color so it colors 
			{7,10, 16} //three of the same color so it colors
		}
	)
);
New Window( "Shape Seg Example",
	gb = Graph Box()
);
gb << append Seg(ss);

But what version of JMP are you using?  I'm using 13.2.1.   I only get 1 segment called shape when I draw it this way.  

But yes, I'm trying color by average of height so if I have 2 rows listed in the first row of {1, 2} with respective values of {59, 61} in height.  I want it to color the shape seg() as if it were 60.  I can fill color the whole thing and it does nothing 

Vince Faller - Predictum
0 Kudos
Highlighted
mikedriscoll
Community Trekker

Re: shapeseg() color by average value

Same version, 13.2.1 64 bit (standard). Mine plots all 3 paths, and with your updated script it is only coloring the 2 like you mentioned. The third i can color manually (right click, color) but I see it isn't what you want.

 

I think you are either going to need to create a new height binning column, say 50-54, 55-59, 60-65, etc, and color by that column, and set your row state groups to correspond that column as well, OR color spectrally, and set your row state row lists in the shape seg by those pre-set colors. (not sure what happens if a user changes row colors).

 

 

 

Highlighted
vince_faller
Super User

Re: shapeseg() color by average value

Yeah it's important to still have that interactivity.  I tried just doing a colmean and coloring by that but I didn't like the way it behaved.  Right now I'm trying to just make a custom private summary table (because it's not exactly a summary) and add a row state handler so that the selection is still there in the main Table.  

Vince Faller - Predictum
0 Kudos
Highlighted
mikedriscoll
Community Trekker

Re: shapeseg() color by average value

Ok. After I re-read your reply I realized the binning column itself won't help but yeah some sort of separate summary column or table associated with those rows would likely work.

0 Kudos