cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
hogi
Level XII

Label by Value: add / remove individual labels

For Heatmap and Bar Graphs, one can add Labels by value.

 

  • - How can I remove values for a specific subset?
    e.g. just show the labels for pass, but don't show the labels for fail.

hogi_1-1686814436132.png

  • How can I define that a label must be shown - even if the area is small
    (M, 16y)

hogi_0-1686814246069.png

Additional question:
How can I change the color of the labels via JSL?

4 REPLIES 4

Re: Label by Value: add / remove individual labels

I have half an answer to your third question: you can change the color of the labels in the property editor. This change doesn't seem to be captured in the script for the graph, though.

Jed_Campbell_0-1686838203593.png

 

txnelson
Super User

Re: Label by Value: add / remove individual labels

I would think that using "<< Add Graphics Script" capability would be the easiest way control the color and visibility of a label for a graph.  One would actually not use the built in labels, but rather, use the text displaying capabilities of the graph primitives in JMP to solve the problem.  

Jim
hogi
Level XII

Re: Label by Value: add / remove individual labels

Hm, with cool Jmp features like a hierarchical X axis, stacked plot  and Label by % of Factor ... 
to recalculate the label values and positions ...
I think I will live with the unnecessary values

Or wait, cheating a bit, using @Jed_Campbell's reply to the third question

hogi_1-1686852112048.png

 

Open( "$SAMPLE_DATA/Titanic Passengers.jmp" );
Graph Builder(
	Variables(
		X( :Passenger Class ),X( :Sex, Position( 1 ) ),
		Overlay( :Survived )
	),
	Elements(
		Bar(
			X( 1 ),	X( 2 ),
			Legend( 12 ),
			Bar Style( "Stacked" ),
			Summary Statistic( "% of Factor" ),
			Label( "Label by Value" )
		)
	),
	SendToReport(
		Dispatch({},"400",ScaleBox,{Legend Model(12,
				Properties( 0, {Fill Color( 36 )}, Item ID( "Yes", 1 ) ),
				Properties( 1, {Fill Color( 19 )}, Item ID( "No", 1 ) )
			)}
		)
	)
);

(Current Report() << xpath("//FrameBox")) << {Text Color( "Medium Dark Red" )}

 

 

hogi
Level XII

Re: Label by Value: add / remove individual labels

Thanks @Jed_Campbell for the suggestion.

 

I just noticed a disadvantage of the approach:
the colors of the labels are reset with every change of the data filter:

(the color of the axis stays as it is - even if the axis scale is changed)

Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
gb = Graph Builder(
	Summary Statistic( "Median" ),
	Graph Spacing( 4 ),
	Variables( X( :age ), Y( :height ), Overlay( :sex ) ),
	Elements( Bar( X, Y, Legend( 8 ), Label( "Label by Value" ) ) ),
);

ldf = gb << 	Local Data Filter(
		Conditional,
		Add Filter( columns( :weight ), Where( :weight >= 102.57 ))
	);
	
(report(gb) << Xpath("//FrameBox")) << {Text Color( "Green" )};
(report(gb) << Xpath("//AxisBox")) << {Text Color( "Green" )};

	wait(1);
	
ldf << clear();