cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to create experiments to support product design and ID useful product features. Register for June 12 webinar, 2pm US Eastern Time.

Discussions

Solve problems, and share tips and tricks with other JMP users.
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

Recommended Articles