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
MagaSganga
Level I

How to denote letters to mark significant differences in a boxplot?

Hi! I have JMP Pro 14. I´m creating several boxplots where I want to show the significant differences between categories with letters above the Q3 like in this graph:

MagaSganga_0-1663024172470.png

How can I put the letters a and b above the boxes? My plot is this one:

MagaSganga_0-1663024426631.png

 

Mi Graph Builder code is: 

Graph Builder(
	Size( 571, 448 ),
	Show Control Panel( 0 ),
	Show Legend( 0 ),
	Show Title( 0 ),
	Show Footer( 0 ),
	Variables( X( :Cat ), Y( :Name( "Pl/min" ) ) ),
	Elements( Box Plot( X, Y, Legend( 6 ), Box Style( "Solid" ) ) ),
	SendToReport(
		Dispatch(
			{},
			"Cat",
			ScaleBox,
			{Reversed Scale, Label Row(
				{Set Font Size( 12 ), Tick Mark( Label( "6" ), Label( "6 " ) ),
				Tick Mark( Label( "7" ), Label( "7 " ) )}
			)}
		),
		Dispatch(
			{},
			"Pl/min",
			ScaleBox,
			{Min( 5.5 ), Max( 18 ), Inc( 2 ), Minor Ticks( 1 )}
		),
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				6,
				Properties(
					0,
					{Line Color( 32 ), Fill Color( 0 )},
					Item ID( "Pl/min", 1 )
				)
			)}
		),
		Dispatch( {}, "X title", TextEditBox, {Set Font Size( 12 )} ),
		Dispatch( {}, "Y title", TextEditBox, {Set Font Size( 12 )} ),
		Dispatch(
			{},
			"Graph Builder",
			FrameBox,
			{DispatchSeg(
				Box Plot Seg( "Box Plot (4)" ),
				{Line Color( {128, 128, 128} ), Fill Color( "Medium Dark Red" )}
			), DispatchSeg(
				Box Plot Seg( "Box Plot (5)" ),
				{Line Color( {128, 128, 128} ), Fill Color( "Medium Dark Yellow" )}
			), DispatchSeg(
				Box Plot Seg( "Box Plot (6)" ),
				{Line Color( "Medium Dark Yellow" ),
				Fill Color( "Medium Dark Green" )}
			), DispatchSeg(
				Box Plot Seg( "Box Plot (7)" ),
				{Line Color( "Medium Dark Yellow" ),
				Fill Color( "Medium Dark BlueCyan" )}
			), DispatchSeg(
				Box Plot Seg( "Box Plot (8)" ),
				{Line Color( "Medium Dark Yellow" ),
				Fill Color( "Medium Dark Magenta" )}
			), DispatchSeg(
				Box Plot Seg( "Box Plot (9)" ),
				{Line Color( "Medium Dark Purple" ),
				Fill Color( "Medium Dark Fuchsia" )}
			)}
		)
	)
);

Thanks in advance. 

Magali. 

1 REPLY 1
jthi
Super User

Re: How to denote letters to mark significant differences in a boxplot?

I think you would have to:

  1. Calculate those letters (based on my 5second googling those letters are from Tukey's test, so I just used some Connecting Letters Report)
  2. Create new column which will map those letters to correct rows
  3. Use that column as marker
  4. Add points to the graph builder
  5. Use suitable summary statistic for points plot to show them in good location (might require new column to create some offset)
  6. Markers should be shown in the graph

You could most likely also combine steps 2-6 into graphic script

 

Here is fairly simple example with Big Class using non graphic script option:

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

fit = dt << Oneway(Y(:height), X(:age), All Pairs(1), invisible);
letters_tb = ((Report(fit)[OutlineBox("Connecting Letters Report")]) << child) << child;

tb_letter_cols = Filter Each({col_name}, letters_tb << Get Names,
	Starts With(col_name, "~Letter Column ")
);

aa_letters = Associative Array();
For Each({level, idx}, letters_tb[1] << get,
	aa_letters[level] = "";
	For Each({letter_col, idx_col}, tb_letter_cols,
		aa_letters[level] ||= letters_tb[1 + idx_col][idx];
	);
);
fit << close window;

dt << New Column("TukeyLetters", Character, Nominal, UseForMarker(1), << Set Each Value(
	aa_letters[char(:age)];
));

gb = dt << Graph Builder(
	Size(529, 451),
	Show Control Panel(0),
	Variables(X(:age), Y(:height)),
	Elements(
		Box Plot(X, Y, Legend(6), Box Style("Solid"), Fences(0)),
		Points(
			X,
			Y,
			Legend(7),
			Summary Statistic("Third Quartile"),
			Error Interval("None")
		)
	)
);

jthi_2-1664619883003.png

 

Edit:

Created wish list item for this Display letters of significance in graph builder when using boxplot and in fit y by x when compariso... 

-Jarmo