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
vince_faller
Super User (Alumni)

Variable Y Reference line based on X

Is there a way to have a reference line either disappear at a certain X or change at a specific X?  For instance

11899_pastedImage_0.png

is it possible for green to go to blue at the purple line?

Vince Faller - Predictum
1 ACCEPTED SOLUTION

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

Re: Variable Y Reference line based on X

It can be done with a graphics script. Right click on the FrameBox and select Customize…

Or do it with jsl. For example:

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

Column("age") << set modeling type(continuous);

gb = dt << Graph Builder(Variables(X(:age), Y(:weight)), Elements(Points(X, Y, Legend(3))));

Report(gb)[Framebox(1)] << Add Graphics Script(

    Description("reflines"),

    bp = 13.5; //breakpoint

    y1 = Mean(:weight[dt << get rows where(:age <= bp)]);

    y2 = Mean(:weight[dt << get rows where(:age > bp)]);

    Line(

        Pen Size(2);

        Pen Color("green");

        {bp, Y Origin()};,

        {bp, Y Range() + Y Origin()}

    );

    Line(

        Pen Size(2);

        Pen Color("blue");

        {X Origin(), y1};,

        {bp, y1}

    );

    Line(

        Line Style(2);

        Pen Size(2);

        Pen Color("gray");

        {bp, y1};,

        {X Range() + X Origin(), y1}

    );

    Line(

        Pen Size(2);

        Pen Color("red");

        {bp, y2};,

        {X Range() + X Origin(), y2}

    );

    Line(

        Line Style(2);

        Pen Size(2);

        Pen Color("gray");

        {X Origin(), y2};,

        {bp, y2}

    );

);

11914_broken_reflines.png

View solution in original post

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

Re: Variable Y Reference line based on X

It can be done with a graphics script. Right click on the FrameBox and select Customize…

Or do it with jsl. For example:

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

Column("age") << set modeling type(continuous);

gb = dt << Graph Builder(Variables(X(:age), Y(:weight)), Elements(Points(X, Y, Legend(3))));

Report(gb)[Framebox(1)] << Add Graphics Script(

    Description("reflines"),

    bp = 13.5; //breakpoint

    y1 = Mean(:weight[dt << get rows where(:age <= bp)]);

    y2 = Mean(:weight[dt << get rows where(:age > bp)]);

    Line(

        Pen Size(2);

        Pen Color("green");

        {bp, Y Origin()};,

        {bp, Y Range() + Y Origin()}

    );

    Line(

        Pen Size(2);

        Pen Color("blue");

        {X Origin(), y1};,

        {bp, y1}

    );

    Line(

        Line Style(2);

        Pen Size(2);

        Pen Color("gray");

        {bp, y1};,

        {X Range() + X Origin(), y1}

    );

    Line(

        Pen Size(2);

        Pen Color("red");

        {bp, y2};,

        {X Range() + X Origin(), y2}

    );

    Line(

        Line Style(2);

        Pen Size(2);

        Pen Color("gray");

        {X Origin(), y2};,

        {bp, y2}

    );

);

11914_broken_reflines.png

vince_faller
Super User (Alumni)

Re: Variable Y Reference line based on X

Oh yeah.  I always forget that I can just draw.  Much appreciated. 

Vince Faller - Predictum