cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
pmroz
Super User

Graph Builder Wrap With different Y Axis Scales

Is there a way to use the wrap functionality of graph builder where all graphs share a common x axis (time), but have differing Y axis scales?  I tried the Page option which is OK, but I'd prefer a grid of graphs.  Here's an example where one of the graphs throws the scale way off for the other graphs.

GBLabs.png

2 ACCEPTED SOLUTIONS

Accepted Solutions
ih
Super User (Alumni) ih
Super User (Alumni)

Re: Graph Builder Wrap With different Y Axis Scales

I've done this sort of thing, still looking for something better though:

Graphs.PNG

 

Names default to here( 1 );

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

//Window to hold graphs
win = New window("Graphs",
	lub = Lineup Box( NCol( 3 ) )
);

//List of graphs to make
ages = ( Associative Array( Column( dt, "age" ) ) << Get Keys );

//For each graph
For( i = 1, i <= N Items( ages ), i++,
	
	//Add graph to the lineup box
	lub << Append( Graph Builder(
		Size( 300, 300 ),
		Show Control Panel( 0 ),
		Show Footer( 0 ),
		Variables( X( :height ), Y( :weight ) ),
		Elements( Points( X, Y, Legend( 3 ) ) ),
		Local Data Filter(
			Close Outline( 1 ),
			Add Filter(
				columns( :age ),
				Where( :age == ages[i] ),
				Display( :age, Size( 224, 126 ), List Display )
			)
		),
		SendToReport(
			Dispatch( {}, "Graph Builder", OutlineBox, {Set Title( "Age: " || char(ages[i]) )} ),
			Dispatch( {}, "graph title", TextEditBox, {Set Text( "" )} )
		)
	); );
	
	
);

//Hide all of the data filters
(win << XPath("//OutlineBox[@helpKey='Data Filter']") ) << Visibility("collapse");

View solution in original post

julian
Community Manager Community Manager

Re: Graph Builder Wrap With different Y Axis Scales

It occurs to me that Peter's original question was about Graph Builder and I gave a solution using Fit Y by X.  If you need Graph Builder functionality, it turns out you can also use Fit Group() with Graph Builder output using a By variable: 

 

Names default to here( 1 );

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

Fit Group(
	Graph Builder(
		Size( 300, 300 ),
		Show Control Panel( 0 ),
		Show Legend( 0 ),
		Variables( X( :height ), Y( :weight ) ),
		Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) ),
		By( :age )
	),
	<<{Arrange in Rows( 3 )}
);

GBGroup.png

 

 

 

 

 

 

View solution in original post

5 REPLIES 5
ih
Super User (Alumni) ih
Super User (Alumni)

Re: Graph Builder Wrap With different Y Axis Scales

I've done this sort of thing, still looking for something better though:

Graphs.PNG

 

Names default to here( 1 );

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

//Window to hold graphs
win = New window("Graphs",
	lub = Lineup Box( NCol( 3 ) )
);

//List of graphs to make
ages = ( Associative Array( Column( dt, "age" ) ) << Get Keys );

//For each graph
For( i = 1, i <= N Items( ages ), i++,
	
	//Add graph to the lineup box
	lub << Append( Graph Builder(
		Size( 300, 300 ),
		Show Control Panel( 0 ),
		Show Footer( 0 ),
		Variables( X( :height ), Y( :weight ) ),
		Elements( Points( X, Y, Legend( 3 ) ) ),
		Local Data Filter(
			Close Outline( 1 ),
			Add Filter(
				columns( :age ),
				Where( :age == ages[i] ),
				Display( :age, Size( 224, 126 ), List Display )
			)
		),
		SendToReport(
			Dispatch( {}, "Graph Builder", OutlineBox, {Set Title( "Age: " || char(ages[i]) )} ),
			Dispatch( {}, "graph title", TextEditBox, {Set Text( "" )} )
		)
	); );
	
	
);

//Hide all of the data filters
(win << XPath("//OutlineBox[@helpKey='Data Filter']") ) << Visibility("collapse");
pmroz
Super User

Re: Graph Builder Wrap With different Y Axis Scales

Thanks @ih that's kind of what I was looking for.  Your solution is general enough I could adapt it for my uses.  

julian
Community Manager Community Manager

Re: Graph Builder Wrap With different Y Axis Scales

It's not obvious, but if you wrap a call to Bivariate() with a By Variable in a Fit Group(), you can take advantage of << {Arrange In Rows()}, both interactively from the Fit Group Red Triangle, and in scripting: 

 

Names default to here( 1 );

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

Fit Group(Bivariate( Y( :weight ), X( :height ), By( :age ) ),<<{Arrange in Rows( 3 )});

FitGroup.png

I hope this helps!

@julian

 

 

julian
Community Manager Community Manager

Re: Graph Builder Wrap With different Y Axis Scales

It occurs to me that Peter's original question was about Graph Builder and I gave a solution using Fit Y by X.  If you need Graph Builder functionality, it turns out you can also use Fit Group() with Graph Builder output using a By variable: 

 

Names default to here( 1 );

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

Fit Group(
	Graph Builder(
		Size( 300, 300 ),
		Show Control Panel( 0 ),
		Show Legend( 0 ),
		Variables( X( :height ), Y( :weight ) ),
		Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) ),
		By( :age )
	),
	<<{Arrange in Rows( 3 )}
);

GBGroup.png

 

 

 

 

 

 

pmroz
Super User

Re: Graph Builder Wrap With different Y Axis Scales

Awesome thanks!