cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to create experiments to support product design and ID useful product features. Register for June 12 webinar, 2pm US Eastern Time.

Discussions

Solve problems, and share tips and tricks with other JMP users.
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

jules
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

6 REPLIES 6
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.  

jules
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!

@jules

 

 

jules
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!

hogi
Level XIII

Re: Graph Builder Wrap With different Y Axis Scales

With JMP18, it's now possible to use "page" for this purpose.
I love it!


Recommended Articles