cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Get the free JMP Student Edition for qualified students and instructors at degree granting institutions.
Choose Language Hide Translation Bar
View Original Published Thread

Graph Builder - How to Nest Group X Variables?

HarriBradbeer
Level II

Hello,

 

I'm trying to plot some data using graph builder, where serial number and response are plotted on X and Y. I'm trying to group by two variables - design and batch, but since each batch is only one design I would like to not include every batch number under each design.

 

image.png

I can achieve close to the results I want by nesting the X-axis, but then I cannot plot by serial #.

HarriBradbeer_0-1739792398719.png

Any solutions for this?

 

4 REPLIES 4
jthi
Super User


Re: Graph Builder - How to Nest Group X Variables?

You could create new column Design + Batch and use that for X Group.

-Jarmo
jthi
Super User


Re: Graph Builder - How to Nest Group X Variables?

Also, why you cannot plot with serialnr if you use only X-axis? I can go from this

jthi_0-1739797124697.png

to this by moving my x groups to x-axis

jthi_1-1739797165228.png

 

-Jarmo
HarriBradbeer
Level II


Re: Graph Builder - How to Nest Group X Variables?

Thanks  jthi, your second solution worked well once I had changed the serial number from continuous to ordinal.

shampton82
Level VII


Re: Graph Builder - How to Nest Group X Variables?

Hey @HarriBradbeer 

Here is a script that will combine either columns you select in the Column list box for graph builder or you select on the actual data table as well.  You can put the "Combined Filter" column it creates into Group X to have the group values from the columns as levels for the Group X axis.  If you select new columns and rerun the script it will update the "Combined Filter" column values.

 

I actually added this as a button to my toolbar to make it more streamlined.

 

Hope this helps!

 

Steve

 

Names Default To Here( 1 );
dt=Current Data Table();
wait(0);
curWindow = current window() << Get Window Title; //get window title to curWindow variable
//use Try to check if curWindow is datatable with << Get name or N Rows
Try(
	//Show(N Rows(Datatable(curWindow))),
	Datatable(curWindow) << Get Name;
	test=0, //datatable
	test=1; //not datatable
);

if( test==1,
	dt << begin Data Update;
	obj=Current Report()["Graph Builder"]<< get scriptable object;


	cnames = (obj<<  XPath("//OutlineBox[text()='Graph Builder']//ListBoxBox")) << get selected;

	cnames=cnames[1];

	dt << Select Columns( eval(cnames) );

	selcols=dt << Get selected Columns();

	/* Obtain a list of all numeric column names as strings. */
	numCols = dt << Get Column Names();
	ct=0;
	/* Loop through each numeric column. */
	For( i = 1, i <=N Items( numCols ) , i++,
		col name = Column( i ) << Get Name;
		if( col name=="Combined Filter",	
			ct=1;
			cti=i;
			break();
			)
	);



	dt << Combine Columns(
		delimiter( "," ),
		Columns( eval(selcols) ),
		Multiple Response( 0 ),
		Column Name( "Combined" )
	);
	dt << Clear Column Selection();
	column(dt,"Combined")<< Set Selected( 1 );
	dt << Move Selected Columns( To last );



	if(ct==0,
		dt<<New Column( "Combined Filter", Character, "Nominal" );
		column(dt,"Combined Filter")<< Set Selected( 1 );
		dt << Move Selected Columns( To first );
	);

	dt << Move Selected Columns( To first );

	for each row(dt,:Combined filter=:Combined );
	
	try(dt << Delete Columns(Column( "Combined" ) ));
	
	wait(0.1);
	
	dt << Go to( eval(selcols) );
	dt << End Data Update;

);

if(test==0,

	dt<<begin data update;

	selcols=dt << Get selected Columns();

	/* Obtain a list of all numeric column names as strings. */
	numCols = dt << Get Column Names();
	ct=0;
	/* Loop through each numeric column. */
	For( i = 1, i <=N Items( numCols ) , i++,
		col name = Column( i ) << Get Name;
		if( col name=="Combined Filter",	
			ct=1;
			cti=i;
			break();
			)
	);


	dt << Combine Columns(
		delimiter( "," ),
		Columns( eval(selcols) ),
		Multiple Response( 0 ),
		Column Name( "Combined" )
	);
	dt << Clear Column Selection();
	column(dt,"Combined")<< Set Selected( 1 );
	dt << Move Selected Columns( To last );



	if(ct==0,
		dt<<New Column( "Combined Filter", Character, "Nominal" );
		column(dt,"Combined Filter")<< Set Selected( 1 );
		dt << Move Selected Columns( To first );
	);
	
	




	for each row(dt,:Combined filter=:Combined );
	
	try(dt << Delete Columns(Column( "Combined" ) ));
	
	wait(0.1);
	
	dt << Go to( eval(selcols) );
	
	dt << End Data Update;
	
);