To add a legend to a graph, send the Row Legend message to the frame box. In the Row Legend message, specify which column you want to base the legend on and whether the legend affects colors and markers.
For example, using Big Class.jmp, submit the following JSL to turn on a legend based on the age column. Set both colors and markers by values in the age column.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = dt << Bivariate( y( :height ), x( :weight ) );
rbiv = biv << Report;
framebox = rbiv[Frame Box( 1 )];
framebox << Row Legend( "age", Color( 1 ), Marker( 1 ) );
// make a legend with the "age" title
// display colors and markers in the legend
The Color() and Marker() arguments are optional. Colors are on and markers are off by default.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = dt << Bivariate( y( :weight ), x( :height ) );
rbiv = biv << Report;
framebox = rbiv[Frame Box( 1 )];
framebox << Row Legend( "age", Color( 1 ), Continuous Scale( 1 ) );
To interactively add a legend, right-click the graph, select Row Legend, and change the column settings.