cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
Create a Box Plot from a Five-Number Summary

Problem

Instead of a full data set, you have a summarized version that contains the five numbers needed to define a box plot.

Solution

You can use frequencies to mimic a full data set based on the five-number summary. If you enter the five data points in a data table and then create a second column with frequencies that force your data points to be at the appropriate quantiles, you can use that data table as if it were the raw data. For a box plot with endpoints at the 5% and 95% quantiles, you could use the five-point summary 3, 15, 20, 40, 42 with frequencies of 5, 20, 25, 25, and 20, respectively. The following JSL gives an example:

Names Default To Here( 1 );
dt = New Table( "Boxplot",
	Add Rows( 5 ),
	New Column( "Summary Point",
		Numeric,
		"Continuous",
		Format( "Best", 18 ),
		Set Values( [3, 15, 20, 40, 42] )
	),
	New Column( "Freq",
		Numeric,
		"Continuous",
		Format( "Best", 18 ),
		Set Values( [5, 20, 25, 25, 20] )
	)
);

dt << Graph Builder(
	Variables( Y( :Summary Point ), Frequency( :Freq ) ),
	Elements( Box Plot( Y, Legend( 7 ) ) )
);

Discussion

The summarized values above are for illustration purposes and can be replaced by other values.

See Also

Discussion Post

JSL Cookbook

If you’re looking for a code snippet or design pattern that performs a common task for your JSL project, the JSL Cookbook is for you.

This knowledge base contains building blocks of JSL code that you can use to reduce the amount of coding you have to do yourself.

It's also a great place to learn from the experts how to use JSL in new ways, with best practices.