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

GraphBuilder Plot: Labels?

Hi, I know how to enable Labels for Heatmaps:the labels are nicely aligned with the heatmap cells and the values correspond to the column values which are used as color. 

hogi_4-1698962284387.png

I also know how to enable labels for point plots - where the labels can be chosen independent of the "color" column:

hogi_6-1698962632747.png

 

Is it possible to combine both approaches:
Heatmap labels, where a column is used as labels which is NOT THE SAME as the column used for color?


Application case:
use a meaningful, normalized value as color [e.g. mortality rate] - but show the actual counts [e.g. Covid 19 victims] as labels.

 

Add-on question:  is it possible to use Character Labels?

e.g. a combination of 

hogi_2-1698961442759.png   and   hogi_1-1698961330799.png

 

... something like:

hogi_3-1698961783152.png

so, similar to adding point labels to a heatmap plot, but with the text nicely confined to the heatmap cells?

 

Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt  << New Formula Column(
	Operation( Category( "Distributional" ), "Rank" ),
	Columns( :height ),
	Group By( :age, :sex )
);


dtsplit = dt << Split(
	Split By( :"Rank[height][age,sex]"n ),
	Split( :name ),
	Group( :age, :sex ),
	Remaining Columns( Drop All )
);

dtCombine = dtsplit << Combine Columns(
	columns( :"1"n, :"2"n, :"3"n, :"4"n, :"5"n, :"6"n, :"7"n ),
	Column Name( "Students" ),
	Delimiter( "," )
);

New Column( "N_students",
	Formula( N Items( Words( :Students, "," ) ) )
);

Graph Builder(
	Variables( Y( :age ), Group X( :sex ), Color( :N_students ) ),
	Elements( Heatmap( Y ) )
);

dtCombine << Split(
	Split By( :sex ),
	Split( :Students ),
	Group( :age ),
	Remaining Columns( Drop All )
)

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: GraphBuilder Plot: Labels?

Set column as label and label by row?

jthi_5-1699035275018.png

 

 

 

 

-Jarmo

View solution in original post

7 REPLIES 7
BHarris
Level VI

Re: GraphBuilder Plot: Labels?

I was about to request this -- we would use this *all the time*.

 

[update -- Jarmo showed that JMP already does this -- kudos!]

hogi
Level XII

Re: GraphBuilder Plot: Labels?

With some cheating (manually adding some linebreaks in the table), the best I can offer at the moment:
a combination of heatmap and points.
... unfortunately with the labels placed somehow arbitrarily

There is an entry in the wish list to solve such issues, but unfortunately it got archived
Label Alignment in Graph Builder 

hogi_1-1699035825275.png

 



dtSplit << Graph Builder(
	Variables( Y( :age ), Group X( :sex ), Color( :N_students ) ),
	Elements(
		Heatmap( Y, Legend( 1 ) ),
		Points( Y, Color( 0 ), Legend( 2 ) )
	),
	SendToReport(
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				2,
				Properties( 0, {Marker Size( 0 )}, Item ID( "age", 1 ) )
			)}
		)
	)
)

 

jthi
Super User

Re: GraphBuilder Plot: Labels?

Set column as label and label by row?

jthi_5-1699035275018.png

 

 

 

 

-Jarmo
hogi
Level XII

Re: GraphBuilder Plot: Labels?

What a wonderful day - it's already there

 

Quite hidden feature!
The labels don't change when rows or columns get added as labels,

The labels just update when the user switches back and forth the label setting.

hogi_0-1699036619288.png

 

hogi
Level XII

Re: GraphBuilder Plot: Labels?

So, actually

Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
:name << Label( 1 );
Graph Builder(
	Variables( X( :sex ), Y( :age ) ),
	Elements( Heatmap( X, Y, Label( "Label by Row" ) ) )
)

... will do the job.

hogi_1-1699043059108.png

 

Is there a setting to get the entries separated by newlines instead of semicolons?

 

jthi
Super User

Re: GraphBuilder Plot: Labels?

Use the earlier script you did use and use \!N as separator

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << New Formula Column(Operation(Category("Distributional"), "Rank"), Columns(:height), Group By(:age, :sex));


dtsplit = dt << Split(Split By(:"Rank[height][age,sex]"n), Split(:name), Group(:age, :sex), Remaining Columns(Drop All));

dtsplit << Combine Columns(columns(:"1"n, :"2"n, :"3"n, :"4"n, :"5"n, :"6"n, :"7"n), Column Name("Students"), Delimiter("\!N"));
//dtCombine << get name;

dtsplit << New Column("N_students", Formula(N Items(Words(:Students, "\!N"))));
Column(dtsplit, "Students") << Label(1);

gb = dtsplit << Graph Builder(
	Variables(Y(:age), Group X(:sex), Color(:N_students)),
	Elements(Heatmap(Y, Legend(1), Label("Label by Row")))
);
-Jarmo
hogi
Level XII

Re: GraphBuilder Plot: Labels?

1:0 for JSL vs. GUI 

Delimiter("\!N")