Names default to here(1);
dt = Open( "$Sample_Data/iris.jmp" );
dt << New Column("Sepal length Binned", Numeric, "Continuous", Format("Fixed Dec", 12, 1), Formula(Floor(:Sepal length / 0.2) * 0.2));
dt << New Column("Is Target", Character, "Nominal", Set Property("Value Colors", {"Is Target" = 59, "The Rest" = 32}), Formula(If(:Species == "setosa", "Is Target", "The Rest")));
//Desired Chart
dt << Graph Builder(
Size( 500, 300 ),
Show Control Panel( 0 ),
Variables(
X( :Sepal length ),
Y( :Sepal length ),
Overlay( :Is Target ),
Color( :Is Target )
),
Elements(
Bar( X, Y, Legend( 11 ), Bar Style( "Stacked" ), Summary Statistic( "N" ) )
),
SendToReport(
Dispatch(
{},
"Sepal length",
ScaleBox,
{Min( 4.1659880239521 ), Max( 8.0340119760479 ), Inc( 0.2 ),
Minor Ticks( 0 )}
)
)
);
//Histogram option - no way to stack bars, leads to confusion when 'Is Target'
//and 'The rest' have similar counts
dt << Graph Builder(
Size( 500, 300 ),
Show Control Panel( 0 ),
Variables(
X( :Sepal length ),
Y( :Sepal length ),
Overlay( :Is Target ),
Color( :Is Target )
),
Elements( Histogram( X, Y, Legend( 12 ) ) ),
SendToReport(
Dispatch(
{},
"Sepal length",
ScaleBox,
{Min( 4.1659880239521 ), Max( 8.0340119760479 ), Inc( 0.2 ),
Minor Ticks( 0 )}
)
)
);