The maps can be Saved into
C:\Users\<user name>\AppData\Roaming\SAS\JMP\Maps
or, they can be saved into $TEMP and then referenced by passing the location to Graph Builder. I took the time to expand your example into a script that creates the Shape Map file, and saves them to $TEMP and finally graphs the data
Names Default To Here( 1 );
dt =
// Open Data Table: Big Class.jmp
// → Data Table( "Big Class" )
Open( "$SAMPLE_DATA/Big Class.jmp" );
// Create the Shape Map tables
dtXY = New Table( "Class-XY",
New Column( "Shape", modeling type( Ordinal ) ),
New Column( "Part", Modeling type( Ordinal ) ),
New Column( "X" ),
New Column( "Y" )
);
dtName = New Table( "Class-Name",
New Column( "Shape", Modeling type( Ordinal ) ),
New Column( "Cell", character )
);
dtName:Cell << set property( "Map Role", Map Role( Shape Name Definition ) );
// Populate the tables
ages = Associative Array( dt:Age << get values ) << get keys;
sexes = Associative Array( dt:Sex << get values ) << get keys;
ID = 0;
For Each( {sex, xi}, sexes,
For Each( {age, yi}, ages,
theName = Char( sex ) || Char( age );show(thename);
ID++;
dtName << add rows( 1 );
dtName:Shape[N Rows( dtName )] = ID;
dtName:Cell[N Rows( dtName )] = theName;
dtXY << add rows( 1 );
dtXY:Shape[N Rows( dtXY )] = ID;
dtXY:Part[N Rows( dtXY )] = ID;
dtXY:X[N Rows( dtXY )] = xi;
dtXY:Y[N Rows( dtXY )] = yi;
dtXY << add rows( 1 );
dtXY:Shape[N Rows( dtXY )] = ID;
dtXY:Part[N Rows( dtXY )] = ID;
dtXY:X[N Rows( dtXY )] = xi;
dtXY:Y[N Rows( dtXY )] = yi + 1;
dtXY << add rows( 1 );
dtXY:Shape[N Rows( dtXY )] = ID;
dtXY:Part[N Rows( dtXY )] = ID;
dtXY:X[N Rows( dtXY )] = xi + 1;
dtXY:Y[N Rows( dtXY )] = yi + 1;
dtXY << add rows( 1 );
dtXY:Shape[N Rows( dtXY )] = ID;
dtXY:Part[N Rows( dtXY )] = ID;
dtXY:X[N Rows( dtXY )] = xi + 1;
dtXY:Y[N Rows( dtXY )] = yi;
)
);
// Save the Map tables to the Temp Directory
close( dtXY, Save( "$temp\mycell-XY.jmp" ));
close( dtName, Save( "$temp\mycell-Name.jmp") );
// Add the concatenated Sex/Age column to the data table
dt << New Column( "Cell", character, set each value( :Sex || Char(:Age)));
// Create the Heat map using the Shape Map
gb = Graph Builder(
Size( 522, 456 ),
Show Control Panel( 0 ),
Variables(
Color( :height ),
Shape(
:Cell,
Set Shape File( "$TEMP/mycell-Name.jmp" )
)
),
Elements(
Map Shapes(
Legend( 3 ),
Summary Statistic( "N" ),
Show Missing Shapes( 1 )
)
),
Local Data Filter(
Add Filter( columns( :height ), Where( :height >= 65.137 ) )
),
SendToReport(
Dispatch(
{},
"",
ScaleBox,
{Format( "Fixed Dec", 12, 0 ), Min( -2.44489795918367 ),
Max( 6.44489795918367 ), Inc( 1 ), Minor Ticks( 0 ),
Label Row(
{Automatic Font Size( 0 ), Automatic Tick Marks( 0 ),
Show Major Labels( 0 ), Show Major Ticks( 0 ), Show Minor Ticks( 0 )
}
)}
),
Dispatch(
{},
"",
ScaleBox( 2 ),
{Min( -0.0843053453846471 ), Max( 7.18430534538465 ), Inc( 1 ),
Minor Ticks( 0 ), Label Row(
{Automatic Font Size( 0 ), Automatic Tick Marks( 0 ),
Show Major Labels( 0 ), Show Major Ticks( 0 ), Show Minor Ticks( 0 )
}
)}
),
Dispatch( {}, "400", LegendBox, {Set Title( "Count" )} )
)
);
// Add the cell labelling to the graph
Report( gb )[FrameBox( 1 )] << Add Graphics script(
For Each( {sex, xi}, sexes,
Eval( Eval Expr( Text( Center Justified, {Expr( xi + .5 ), .5}, Expr( sex ) ) ) )
);
For Each( {age, yi}, ages,
Eval( Eval Expr( Text( Center Justified, {.5,Expr( yi + .5 ) }, Expr( char(age) ) ) ) )
);
);
Jim