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
miguello
Level VI

Graph Builder Charts By Variable with different Y axis scales

All, 

I need to modify my Scripted Graph Builder so that it sets various scales for each plot.

I have a table of the (simplified) form:

:date - just a date

:rawValue - some numeric value

:byVariable - several categorical values to separate :rawValues into groups

:rawMedian - just a median value for each of the groups, formula Col Quantile(:rawValue, 0.5, :byVariable)

 

I plot it this way:

 

Graph Builder(
Size( 800, 500 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables(
X( :date ),
Y( :rawValue ),
Y( :rawMedian ) //It's just a straight horizontal line on each plot
),
By( :byVariable )

)

Now, I would like to set the Y axis scale for each plot separately, and be equal, let's say, 3*:rawMedian for that specific :byVariable.

What's the best way of doing this?

 

Thanks, 

M.

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Graph Builder Charts By Variable with different Y axis scales

Here is a simple example that is setting different values for each of the axes for the by groups.  If you don't understand how the script is using the Display Trees to change the values, the Display Trees are documented in the Scripting Guide

     Help==>Documentation Library

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/aircraft incidents.jmp" );
dt:Event Date << set name( "Date" );
dt:Total Uninjured << set name( "rawValue" );
dt:Engine Type << set name( "byVariable" );
dt << New Column( "rawMedian", formula( Col Quantile( :rawValue, .5, :byVariable ) ) );

gb = Graph Builder(
	Size( 800, 500 ),
	Show Control Panel( 0 ),
	Show Legend( 0 ),
	Variables(
		X( :date ),
		Y( :rawValue ),
		Y( :rawMedian ) //It's just a straight horizontal line on each plot
	),
	By( :byVariable )
);

summarize(groups=by(:byVariable));
// loop across the different byVariable values and changes the axes
For(i=1,i<=nitems(groups), i++,
	report(gb[i])[AxisBox(2)]<< max (14-i);
	report(gb[i])[AxisBox(3)] << min (.6 +.01*i);
);
Jim

View solution in original post

3 REPLIES 3
txnelson
Super User

Re: Graph Builder Charts By Variable with different Y axis scales

Here is a simple example that is setting different values for each of the axes for the by groups.  If you don't understand how the script is using the Display Trees to change the values, the Display Trees are documented in the Scripting Guide

     Help==>Documentation Library

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/aircraft incidents.jmp" );
dt:Event Date << set name( "Date" );
dt:Total Uninjured << set name( "rawValue" );
dt:Engine Type << set name( "byVariable" );
dt << New Column( "rawMedian", formula( Col Quantile( :rawValue, .5, :byVariable ) ) );

gb = Graph Builder(
	Size( 800, 500 ),
	Show Control Panel( 0 ),
	Show Legend( 0 ),
	Variables(
		X( :date ),
		Y( :rawValue ),
		Y( :rawMedian ) //It's just a straight horizontal line on each plot
	),
	By( :byVariable )
);

summarize(groups=by(:byVariable));
// loop across the different byVariable values and changes the axes
For(i=1,i<=nitems(groups), i++,
	report(gb[i])[AxisBox(2)]<< max (14-i);
	report(gb[i])[AxisBox(3)] << min (.6 +.01*i);
);
Jim
miguello
Level VI

Re: Graph Builder Charts By Variable with different Y axis scales

Jim,

Yes, I came to the same conclusion. Only I'm doing a temp summary table for all byVariables and read it into an Associative Array. My data table structure and plots are much more complicated than I showed, that's why. What I'm trying to do now and what I'm struggling with is finding the right AxisBox on my plot.
txnelson
Super User

Re: Graph Builder Charts By Variable with different Y axis scales

Right click on the Outline box for the Graph builder, and select Edit==>Show Tree Structure, then when you click on the axis you are interested in, it will highlight in the tree structure
Jim