Our World Statistics Day conversations have been a great reminder of how much statistics can inform our lives. Do you have an example of how statistics has made a difference in your life? Share your story with the Community!
Choose Language Hide Translation Bar

## A Simple Script to Illustrate Axis Changes in One Chart Controling the Axis in a Different Chart

// This Simple script illustrate a method to allow the axis settings from

// one platform, to replicate the same settings in a different platform's

// graph.

// This example places both platform's utput in the same window, but

// they could reside in separate window is that is what is desired

Names Default To Here( 1 );

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

// Initialize Flagging Variables

// These variables will hold the last ettings for the

// Y Origin and Y Range for each graph.  When one of the

// Y axes is changed, it will be detected by comparing it with

// the last value that is being held in these columns

BivYOrigin = 0;

BivYRange = 0;

OWYOrigin = 0;

OWYRange = 0;

// Create a simple display output

New Window( "One Axis Setting Changes Both Graphs",

H List Box(

OW= dt << Oneway(

Y(:height ),

X(:sex ),

Means(1 ),

Box Plots( 1 ),

Mean Diamonds( 1 ),

SendToReport(

Dispatch(

{},

"Oneway Plot",

FrameBox,

{DispatchSeg(Box Plot Seg( 1 ), {Box Type( "Outlier" ), Line Color( "Red" )} ),

DispatchSeg(Box Plot Seg( 2 ), {Box Type( "Outlier" ), Line Color( "Red" )} ),

Row Legend(

sex,

Color(1 ),

Color Theme( "JMP Default" ),

Marker( 0 ),

Marker Theme( "" ),

Continuous Scale( 0 ),

Reverse Scale( 0 ),

Excluded Rows( 0 )

)}

)

)

);

Biv= dt << Bivariate(

Y(:height ),

X(:weight ),

Fit Where( :sex == "F", Fit Line( {Line Color( {213, 72, 87} )} ) ),

Fit Where( :sex == "M", Fit Line( {Line Color( {64, 111, 223} )} ) )

);

)

);

// Add a graphic script to the OneWay graph, that detects the

// changes to it's Y Axis, and copies the new settings to

// the Y Axis of the Bivariate Plot

Report( OW )[Frame Box( 1 )] << add graphics script(

// Check for a change

If( OWYOrigin != Y Origin() | OWYRange != Y Range(),

// If a change is found, copy the new Y Origin and Y Range

// to the Flagging(Holding) variables

OWYOrigin= Y Origin();

OWYRange= Y Range();

// Copy the new axis settings from the OneWay display

// to the Bivariate Y Axis

Report( OW )[Axis Box(1 )] << Copy Axis Settings;

Report( Biv )[Axis Box( 1 )] << Paste Axis Settings;

)

);

// Add the graphic script to the Bivariate plot to perform the

// same actions, but from the Bivariate plot's point of view.

Report( Biv )[Frame
Box(
1 )] << add graphics script(

If( BivYOrigin != Y Origin() | BivYRange != Y Range(),

BivYOrigin= Y Origin();

BivYRange= Y Range();

Report( Biv )[Axis Box( 1 )] << Copy Axis Settings;

Report( OW )[Axis Box(1 )] << Paste Axis Settings;

)

);

Article Labels
Article Tags