Subscribe Bookmark RSS Feed

How to Use Variables in Overlay Plots

terapin

Community Trekker

Joined:

Jun 23, 2011

I often create overlay plots for climate data I analyze and need to be able to quickly change the naming of the column variables used so that I can plot data from different sites. My column naming conventions are such that column names are the same except for a Site Identifier in the name. E.g.,

Tair, FCO (C)
Tair, FCF (C)
Tair, CH3 (C)

Since I have multiple summary tables and/or overlay plots that refer to the same column variables, I would like to be able write the JSL code such that I can change the variable name used in the summary table and overlay plot one time at the top of the program rather than at each separate location.

In the example below I summarize and plot data from sites FCO & FCF. I would like to be able to quickly change to sites FCO and CH3 without changing this code at each location. Any suggestions on how to accomplish this would be greatly appreciated.


sum1 = dt1 << Summary(
Group( :Year, :Month, :Day of Year ),
Min( :Name( "Date & Time" ) ),
N( :Name( "Tair, FCO (C)" ) ),
N( :Name( "Tair, FCF (C)" ) ),
// N( :Name( "Tair, CH3 (C)" ) ),
N( :Name( "Corrected, Tair, FCO (C)" ) ),

);

sdate = Date MDY ( 10, 01, 2002 );
edate = Date MDY ( 11, 31, 2002 );


New Window("Overlay Plot",
V List Box(
op1 = sum1 << Overlay Plot(
X( :Name( "Min(Date & Time)" ) ),
Y( :Name( "N(Tair, FCO (C))" ),
:Name( "N(Tair, FCF (C))" ),
// :Name( "N(Tair, CH3 (C))" ),
:Name( "N(Corrected, Tair, FCO (C))" ),
),
Y Scale( Left, Left, Left ),
Separate Axes( 1 ),
Overlay Plots ( 1 ),
Connect Thru Missing( 1 ),
Marker Size ( 1 ),
),
Report ( op1 )[ Frame Box ( 1 ) ]
<< Frame Size( 750, 350 ),
Report ( op1 ) [ Axis Box ( 1 ) ]
<< Axis Settings( { Format( "Fixed Dec", 10, 0), Min( 0 ), Max( 25 ),
Inc( 2 ), Minor Ticks( 1 ), Show Major Grid( 1 ) } ),
Report ( op1 ) [ Axis Box ( 2 ) ]
<< Axis Settings( { Format( "m/d/y", 10 ), Interval( "Month" ),
Inc( 1 ), Minor Ticks ( 0 ), Show Major Grid( 1 ), Show Minor Grid ( 0 ),
Min( sdate ), Max( edate ) } )
<< Remove Axis Label
<< Add Axis Label ( "Date" ),
)
);
1 REPLY
I'm giving a talk at the UK user group next week, to present a pattern of code that allows you to "wrap" JMP generated script into a reusable code. It creates a callable function that can be parsed arguments. If you contact me at david.burnham@pega-analytics.co.uk I can send you the script.