I am trying to make the formatting of multiple similar plots into an expression so I can change a single section of the code to update all plots that look alike. However, I have a hard time implementing it into code. I am including a minimal working example showing how I would like a plot to look like and how I would like my code to look like, storing a piece of code for the formatting and a compact code for each plot. Any idea on how I can modify this to make it work? I am working on JMP version 15.2.
dt = New Table( "Minimal Working Example",
Add Rows( 400 ),
New Column( "X", Numeric, Set Values( Repeat( 1 :: 20, 20 ) ) ),
New Column( "Y", Numeric, Set Values( Sort Ascending( Shape( Repeat( 1 :: 20, 20 ), 1 ) ) ) ),
New Column( "Size", Numeric, <<Formula( Random Uniform( 0, 1 ) ) )
);
// How I would like the plot to look like
dt << Graph Builder(
Variables( X( :X ), Y( :Y ), Color( :Size ) ),
Elements( Points( X, Y, Legend( 8 ) ) ),
SendToReport(
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
8,
Properties(
0,
{gradient( {Color Theme( "White to Red" )} )},
Item ID( "Size", 1 )
)
)}
),
Dispatch(
{},
"400",
LegendBox,
{Legend Position( {8, [0, -1]} ), Position( {0, -1} )}
)
)
);
// A theme format I could change for a gazillion of plots
formats = Expr(
SendToReport(
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
8,
Properties(
0,
{gradient( {Color Theme( "White to Red" )} )},
Item ID( "Size", 1 )
)
)}
),
Dispatch(
{},
"400",
LegendBox,
{Legend Position( {8, [0, -1]} ), Position( {0, -1} )}
)
)
);
// How I would like each plot code to look like
dt << Graph Builder(
Variables( X( :X ), Y( :Y ), Color( :Size ) ),
Elements( Points( X, Y, Legend( 8 ) ) ),
formats
);