Subscribe Bookmark RSS Feed

Box plot mean point

Is there a way to add a mark for the mean value to a boxplot in JMP?
1 ACCEPTED SOLUTION

Accepted Solutions
Dahlia_Watkins

Joined:

Jan 24, 2017

Solution

As written above,

 

You'll need first to create a variability/gauge chart, then select the "show box plots" option to add the boxes. You should then find that the means are shown automatically, but if they're not, click on the small red triangle to the left of the "Variability Gauge" header and select "Show cell means". To join them up as well, check "Connect cell means".

The following script should create a set of box plots on a dummy data file and join the means as described above:

dt1 = New Table( "Data Table",
	add rows( 50 ),
	New Column( "Group", character ),
	New Column( "Data", numeric )
);
For( i = 1, i <= N Row( dt1 ), i++,
	Column( dt1, "Group" )[i] = Choose( Random Integer( 1, 5 ),
		"A",
		"B",
		"C",
		"D",
		"E"
	);
	Column( dt1, "Data" )[i] = Random Uniform( 0, 100 );
);
Variability Chart(
	Y( :Data ),
	X( :Group ),
	Analysis Type( Name( "Box Plot" ) ),
	Connect Cell Means( 1 ),
	Std Dev Chart( 1 ),
	Show Box Plots( 1 )
);

 

4 REPLIES

You'll need first to create a variability/gauge chart, then select the "show box plots" option to add the boxes. You should then find that the means are shown automatically, but if they're not, click on the small red triangle to the left of the "Variability Gauge" header and select "Show cell means". To join them up as well, check "Connect cell means".


The following script should create a set of box plots on a dummy data file and join the means as described above:

dt1 = New Table( "Data Table",
	add rows( 50 ),
	New Column( "Group", character ),
	New Column( "Data", numeric )
);
For( i = 1, i <= N Row( dt1 ), i++,
	Column( dt1, "Group" )[i] = Choose( Random Integer( 1, 5 ),
		"A",
		"B",
		"C",
		"D",
		"E"
	);
	Column( dt1, "Data" )[i] = Random Uniform( 0, 100 );
);
Variability Chart(
	Y( :Data ),
	X( :Group ),
	Analysis Type( Name( "Box Plot" ) ),
	Connect Cell Means( 1 ),
	Std Dev Chart( 1 ),
	Show Box Plots( 1 )
);

 

Thank you! I tried it and it works.
Naama
rc_hertzy

Community Trekker

Joined:

Jun 23, 2011

If you are considering ANOVA, then use One Way (e.g., from the JMP Starter window) on the data and select Display Options>Box Plots, and Display Options>Connect Means. It treats the x axis as categories, so if a continuous variable, the spacing is not correct. In this example with dose-response data, Dose is the X,Grouping variable. What I like is then the Oneway window is open so you can explore other analyses (e.g., equal variances).
Here is a script:

New Window(
"Dataset: Oneway of Response by Dose",
H List Box(
Oneway(
Y( :Response ),
X( :Name( "Dose" ) ),
Box Plots( 1 ),
Connect Means( 1 ),
Mean Diamonds( 0 ),
Points Jittered( 1 ),
Grand Mean( 0 )
), ) );
Dahlia_Watkins

Joined:

Jan 24, 2017

Solution

As written above,

 

You'll need first to create a variability/gauge chart, then select the "show box plots" option to add the boxes. You should then find that the means are shown automatically, but if they're not, click on the small red triangle to the left of the "Variability Gauge" header and select "Show cell means". To join them up as well, check "Connect cell means".

The following script should create a set of box plots on a dummy data file and join the means as described above:

dt1 = New Table( "Data Table",
	add rows( 50 ),
	New Column( "Group", character ),
	New Column( "Data", numeric )
);
For( i = 1, i <= N Row( dt1 ), i++,
	Column( dt1, "Group" )[i] = Choose( Random Integer( 1, 5 ),
		"A",
		"B",
		"C",
		"D",
		"E"
	);
	Column( dt1, "Data" )[i] = Random Uniform( 0, 100 );
);
Variability Chart(
	Y( :Data ),
	X( :Group ),
	Analysis Type( Name( "Box Plot" ) ),
	Connect Cell Means( 1 ),
	Std Dev Chart( 1 ),
	Show Box Plots( 1 )
);