Subscribe Bookmark RSS Feed

Box Plot Properties

In the following little script I've created a box plot using the Graph Builder, and then listed all the properties of the object I've just created:

dt = open("$SAMPLE_DATA/Big Class.jmp");

dtg = Graph Builder(

       Show Control Panel( 0 ),

       Variables( X( dt:sex ), Y( dt:height ) ),

       Elements( Box Plot( X, Y, Outliers( 1 ), Box Style( "Outlier" ) ) )

);

show properties(dtg);

Now - suppose later in the script I wanted to change the box style from "Outlier" to one of the other three available options ("Quantile", "Solid" or "Thin").  I see that among the properties of dtg there's one called "Elements", which is presumably the one I need to access - but I don't know how to change one of its settings.  My first guess would be something like "dtg << elements(Box Style(Box Plot("Solid"))), but that doesn't work.  Can something like that be done, and if so, how?

Many thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

There may be a simpler way to express it but the following seems to work. I made the changes to each box plot using "Customize" in Graph Builder, looked at the script, and moved the SendToReport stuff from within GB to outside it. If there is an undetermined number of categories then you'd have to handle that somehow as well. When I changed both bars simultaneously in GB the resulting script simply replaced "Outlier" with "Solid" instead of showing code to make the change.

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

dtg = Graph Builder(

    Show Control Panel( 0 ),

    Variables( X( dt:sex ), Y( dt:height ) ),

    Elements( Box Plot( X, Y, Outliers( 1 ), Box Style( "Outlier" ) ) )

);

dtg << SendToReport(

    Dispatch(

        {},

        "Graph Builder",

        FrameBox,

        {DispatchSeg( BoxPlotSeg( 1 ), Box Style( "Solid" ) ),

        DispatchSeg( BoxPlotSeg( 2 ), Box Style( "Solid" ) )}

    )

);

2 REPLIES
Solution

There may be a simpler way to express it but the following seems to work. I made the changes to each box plot using "Customize" in Graph Builder, looked at the script, and moved the SendToReport stuff from within GB to outside it. If there is an undetermined number of categories then you'd have to handle that somehow as well. When I changed both bars simultaneously in GB the resulting script simply replaced "Outlier" with "Solid" instead of showing code to make the change.

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

dtg = Graph Builder(

    Show Control Panel( 0 ),

    Variables( X( dt:sex ), Y( dt:height ) ),

    Elements( Box Plot( X, Y, Outliers( 1 ), Box Style( "Outlier" ) ) )

);

dtg << SendToReport(

    Dispatch(

        {},

        "Graph Builder",

        FrameBox,

        {DispatchSeg( BoxPlotSeg( 1 ), Box Style( "Solid" ) ),

        DispatchSeg( BoxPlotSeg( 2 ), Box Style( "Solid" ) )}

    )

);

That's just what I needed - many thanks!  And thanks also for the explanation of how to work it out: that's also very useful for future reference.