cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
TheNewBee
Level I

Graph Builder - Box plot with groups of columns ?

I have a small dataset with multiple columns. 

Some of these columns are grouped. In the graph builder, can I create single box plot with data per-group, instead of individual columns ?

 

TheNewBee_0-1597370340992.png

TheNewBee_1-1597370351674.png

 

2 REPLIES 2
statman
Super User

Re: Graph Builder - Box plot with groups of columns ?

I might be misinterpreting your question, and in the future if you attach the JMP data table it might be easier to show you, but I you can stack the A, B and C columns so you have now three columns of data with A, B and C labels.

"All models are wrong, some are useful" G.E.P. Box
txnelson
Super User

Re: Graph Builder - Box plot with groups of columns ?

The way to do this is to simply

  1. Stack the columns
  2. Make a new column that groups the data
  3. Run the Graph Builder with the Grouping column as the X axis

abc.PNG

Below is an example using JSL, however each step in the script can be easily done interactively.  See the script below

names default to here(1);

// Create a sample data table for illustration
dt=new table("TO_CPTO_C",
	add rows(5),
	new column("A.1", formula(randomuniform(70,140)),format("fixed dec",6,2)),
	new column("A.2", formula(randomuniform(70,140)),format("fixed dec",6,2)),	
	new column("A.3", formula(randomuniform(70,140)),format("fixed dec",6,2)),
	new column("A.4", formula(randomuniform(70,140)),format("fixed dec",6,2)),
	new column("A.5", formula(randomuniform(70,140)),format("fixed dec",6,2)),
	new column("A.6", formula(randomuniform(70,140)),format("fixed dec",6,2)),
	new column("B.1", formula(randomuniform(70,140)),format("fixed dec",6,2)),
	new column("B.2", formula(randomuniform(70,140)),format("fixed dec",6,2)),	
	new column("B.3", formula(randomuniform(70,140)),format("fixed dec",6,2)),
	new column("B.4", formula(randomuniform(70,140)),format("fixed dec",6,2)),
	new column("C.1", formula(randomuniform(70,140)),format("fixed dec",6,2)),
	new column("C.2", formula(randomuniform(70,140)),format("fixed dec",6,2)),	
	new column("C.3", formula(randomuniform(70,140)),format("fixed dec",6,2)),
	new column("C.4", formula(randomuniform(70,140)),format("fixed dec",6,2))
);

// Pause so one can see initial data table before moving on
Wait( 5 );

// Stack the columns
// Tables==>Stack
dtStack = dt << Stack(
	columns(
		:A.1,
		:A.2,
		:A.3,
		:A.4,
		:A.5,
		:A.6,
		:B.1,
		:B.2,
		:B.3,
		:B.4,
		:C.1,
		:C.2,
		:C.3,
		:C.4
	),
	Source Label Column( "Label" ),
	Stacked Data Column( "Data" )
);

// Pause so one can see stacked data table before moving on
Wait( 5 );

// Create a grouping column
dtStack << New Column("Group", character, formula( left(:Label,1 )));

// Pause so one can see new column before moving on
Wait( 5 );

// Create the Graph, using the Group column as the X axis and Data as the Y axis
dtStack << Graph Builder(
	Size( 534, 450 ),
	Show Control Panel( 0 ),
	Variables( X( :Group ), Y( :Data ) ),
	Elements( Box Plot( X, Y, Legend( 3 ) ) )
);

 

Jim