Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Aug 21, 2013 9:40 AM
(17777 views)

Does anyone have a smarter way to add a 45° (y=x) line to an x-y plot? I currently do the following:

- Set x-axis and y-axis pixels to the same value in the Frame Size dialog
- Use the drawing tool to manually add a line to the plot

The line is never quite perfect and has to be adjusted when plot is changed.

JMP Developers: this would be a great option to add to: Y-axis specification, Reference Lines. It is useful when comparing predicted versus actual; lab determinations versus standard values; etc.. Thinking about this more, having the option to enter f(x) for a y-reference line would be even better than just the 45° (y=x) line.

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Created:
Aug 21, 2013 11:58 AM
| Last Modified: Jun 15, 2018 5:31 AM
(22842 views)
| Posted in reply to message from markschahl 08-21-2013

In the *Fit Y by X* platform you can choose *Fit special...* and lock intercept to zero and slope to one.

In most platforms it is also possible to draw a line representing a function by a graphics script. Right-click on the graph and select *Customize...* In the dialog press the plus sign and select *Y Function* in the *Templates* drop-down menu. Add *Y Function( y = x, x ); *to get a straight y=x line.

JSL-example:

```
dt = Open( "$SAMPLE_DATA/Fitness.jmp" );
biv = dt << Bivariate( Y( :MaxPulse ), X( :RunPulse ) );
Report( Biv )[Framebox( 1 )] << add graphics script( Y Function( y = x, x ) );
```

5 REPLIES 5

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Created:
Aug 21, 2013 11:58 AM
| Last Modified: Jun 15, 2018 5:31 AM
(22843 views)
| Posted in reply to message from markschahl 08-21-2013

In the *Fit Y by X* platform you can choose *Fit special...* and lock intercept to zero and slope to one.

In most platforms it is also possible to draw a line representing a function by a graphics script. Right-click on the graph and select *Customize...* In the dialog press the plus sign and select *Y Function* in the *Templates* drop-down menu. Add *Y Function( y = x, x ); *to get a straight y=x line.

JSL-example:

```
dt = Open( "$SAMPLE_DATA/Fitness.jmp" );
biv = dt << Bivariate( Y( :MaxPulse ), X( :RunPulse ) );
Report( Biv )[Framebox( 1 )] << add graphics script( Y Function( y = x, x ) );
```

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: How to add 45° (y=x) line to graph?

Created:
Aug 21, 2013 1:16 PM
| Last Modified: Jun 15, 2018 5:32 AM
(16351 views)
| Posted in reply to message from ms 08-21-2013

Very cool. I tried it in Graph Builder and it works like a charm. Here's an example:

```
dt = open("$sample_data\Boston Housing.jmp");
gb = Graph Builder(
Show Control Panel( 0 ),
Variables( X( :rooms ), Y( :distance ) ),
Elements( Points( X, Y, Legend( 1 ) ) ),
SendToReport(
Dispatch( {}, "rooms", ScaleBox,
{Min( 0 ), Max( 12 ), Inc( 2 ), Minor Ticks( 1 )} ),
Dispatch( {}, "distance", ScaleBox,
{Min( 0 ), Max( 12 ), Inc( 2 ), Minor Ticks( 1 )} ),
Dispatch( {}, "Graph Builder", FrameBox,
{Marker Size( 3 ), Add Graphics Script(
2, Description( "Script" ), Y Function( x, x )
), Grid Line Order( 1 ), Reference Line Order( 3 )} )
)
);
```

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: How to add 45° (y=x) line to graph?

Created:
Aug 21, 2013 10:21 PM
| Last Modified: Jun 15, 2018 5:33 AM
(16351 views)
| Posted in reply to message from ms 08-21-2013

Here is another script using the Bivariate platform (I use JMP 10.0.2):

```
dt = Open("$SAMPLE_DATA/Fitness.jmp");
dt << Bivariate(
Y(:MaxPulse),
X(:RunPulse),
SendToReport(
Dispatch(
{},
"Bivar Plot",
FrameBox,
{Add Graphics Script(2, Description("Script"), YFunction(x, x)),
Grid Line Order(1), Reference Line Order(3)}
)
)
);
```

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: How to add 45° (y=x) line to graph?

How can the 45 degree reference line be reformatted as dashes and alternate color?

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: How to add 45° (y=x) line to graph?

Created:
Mar 12, 2016 2:01 PM
| Last Modified: Jun 15, 2018 5:33 AM
(16351 views)
| Posted in reply to message from josh 03-12-2016

Here is a version of the platform with the line dashed and red

```
dt = Open( "$sample_data\Boston Housing.jmp" );
gb = Graph Builder(
Show Control Panel( 0 ),
Variables( X( :rooms ), Y( :distance ) ),
Elements( Points( X, Y, Legend( 1 ) ) ),
SendToReport(
Dispatch( {}, "rooms", ScaleBox, {Min( 0 ), Max( 12 ), Inc( 2 ), Minor Ticks( 1 )} ),
Dispatch( {}, "distance", ScaleBox, {Min( 0 ), Max( 12 ), Inc( 2 ), Minor Ticks( 1 )} ),
Dispatch(
{},
"Graph Builder",
FrameBox,
{Marker Size( 3 ), Add Graphics Script(
2,
Description( "Script" ),
Pen Color( "red" );
Line Style( "dashed" );
Y Function( x, x );
), Grid Line Order( 1 ), Reference Line Order( 3 )}
)
)
);
```

The Graphing Elements are documented in the Scripting Guide, starting on page 497. The Scripting Guide is available under the JMP Help==>Books==>Scripting Guide.

Jim

Article Labels

There are no labels assigned to this post.