cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
jvillaumie
Level III

Variability chart & JSL: adding different ref. lines for the different Groups, or append Var chart to each other?

Hello,

I am trying to use JSL to show different reference lines for each group in a variability chart. The following picture is the end result I am looking for (done manually, not using JSL): I created 6 separate variability charts, one for each group, each with its own ref. lines (pictures 2 to 7),  then dragged the contents of each chart to the 1st chart using the Selection tool get the overall chart.

Can this be scripted, and if so using which command & syntax ?

Alternatively, can reference lines be added to a Variability chart for specific groups, as opposed to having the ref. line run all the way across the chart?

9768_Var chart 1.png9769_Var chart 2.png

1 ACCEPTED SOLUTION

Accepted Solutions
ms
Super User (Alumni) ms
Super User (Alumni)

Re: Variability chart & JSL: adding different ref. lines for the different Groups, or append Var chart to each other?

Group-wise partial reference lines can be simulated with a graphics script. Below is an attempt that certainly can be further improved. Currently the reflines are connected giving an impression of an step function (which may or may not be desirable).

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

vc = dt << Variability Chart(Y(:height), X(:age), Std Dev Chart(0));

// Define reflines;

// In this example they are quartiles but could be any custom list

Summarize(g = by(dt:age), ref = Quantile(dt:height, 0.25));

//Build and eval graphics script expression

lineexpr = Expr(Line());

For(i = 1, i <= N Items(g), i++,

    Insert Into(lineexpr, Eval List({i - 1, ref[i]}));

    Insert Into(lineexpr, Eval List({i, ref[i]}));

);

Eval(

    Eval Expr(

        Report(vc)[framebox(1)] << add graphics script(

            Line Style("Dotted");

            Pen Color("red");

            Expr(Name Expr(lineexpr));

        )

    )

);

View solution in original post

2 REPLIES 2
ms
Super User (Alumni) ms
Super User (Alumni)

Re: Variability chart & JSL: adding different ref. lines for the different Groups, or append Var chart to each other?

Group-wise partial reference lines can be simulated with a graphics script. Below is an attempt that certainly can be further improved. Currently the reflines are connected giving an impression of an step function (which may or may not be desirable).

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

vc = dt << Variability Chart(Y(:height), X(:age), Std Dev Chart(0));

// Define reflines;

// In this example they are quartiles but could be any custom list

Summarize(g = by(dt:age), ref = Quantile(dt:height, 0.25));

//Build and eval graphics script expression

lineexpr = Expr(Line());

For(i = 1, i <= N Items(g), i++,

    Insert Into(lineexpr, Eval List({i - 1, ref[i]}));

    Insert Into(lineexpr, Eval List({i, ref[i]}));

);

Eval(

    Eval Expr(

        Report(vc)[framebox(1)] << add graphics script(

            Line Style("Dotted");

            Pen Color("red");

            Expr(Name Expr(lineexpr));

        )

    )

);

jvillaumie
Level III

Re: Variability chart & JSL: adding different ref. lines for the different Groups, or append Var chart to each other?

Thanks MS,

I can see how this works now and I tweaked your script to not connect the ref. lines between groups. The way I scripted is not elegant, but it is functional. I will refine my script later to make the ref. lines table variables and add a for loop, like in your example.

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

vc = dt << Variability Chart(Y(:height), X(:age), Std Dev Chart(0));


// Define reflines;


//Build and eval graphics script expression

lineexpr1 = Expr(Line());
Insert Into(lineexpr1, Eval List({0, 55}));
Insert Into(lineexpr1, Eval List({1, 55}));

lineexpr2 = Expr(Line());
Insert Into(lineexpr2, Eval List({1, 60}));
Insert Into(lineexpr2, Eval List({2, 60}));

lineexpr3 = Expr(Line());
Insert Into(lineexpr3, Eval List({2, 65}));
Insert Into(lineexpr3, Eval List({3, 65}));


Eval(

    Eval Expr(

        Report(vc)[framebox(1)] << add graphics script(
            Line Style("Dotted");
            Pen Color("red");
            Expr(Name Expr(lineexpr1));

            Line Style("Dotted");
            Pen Color("red");          
            Expr(Name Expr(lineexpr2)); 

            Line Style("Dotted");
            Pen Color("red");
            Expr(Name Expr(lineexpr3));                    
        )  
    )

);