turn on suggestions

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

Showing results for

- JMP User Community
- :
- Discussions
- :
- Discussions
- :
- Re: Shading in on graph builder

Topic Options

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

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

A week ago
(203 views)

I have a chart that evolves over time. At each time point I compute a point estimate and for each point estimate I compute a lower and upper confidence interval value. This gives a range at each time point but it also gets narrower over time as I have more data as time evolves.

An example of some data and the chart I created in graph builder are attached.

Is there a way of coding to shade in the region that is covered by the interval estimate?

I include a PNG file to hopefully make clear what I mean. (The yellow would extend from beginning to end of the time period.)

If anybody can help would be great.

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

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

A week ago
(361 views)

Solution

You can add any kind of graphics to your Graph Builder output by adding an

Add Graphics Script

item to your platform. See the script below:

```
dt=current data table();
Graph Builder(
Size( 531, 454 ),
Show Control Panel( 0 ),
Variables(
X( :Index ),
Y( :Point estimate ),
Y( :Lower, Position( 1 ) ),
Y( :Upper, Position( 1 ) )
),
Elements(
Points( X, Y( 1 ), Y( 2 ), Y( 3 ), Legend( 3 ) ),
Line( X, Y( 1 ), Y( 2 ), Y( 3 ), Legend( 5 ) )
),
SendToReport(
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
3,
Base( 0, 0, 0, Item ID( "Point estimate", 1 ) ),
Base( 1, 0, 0, Item ID( "Lower", 1 ) ),
Base( 2, 0, 0, Item ID( "Upper", 1 ) ),
Properties( 0, {Line Color( 0 )}, Item ID( "Point estimate", 1 ) ),
Properties( 1, {Line Color( 0 )}, Item ID( "Lower", 1 ) ),
Properties( 2, {Line Color( 0 )}, Item ID( "Upper", 1 ) )
), Legend Model(
5,
Properties( 0, {Line Color( 0 )}, Item ID( "Point estimate", 1 ) ),
Properties( 1, {Line Color( 0 )}, Item ID( "Lower", 1 ) ),
Properties( 2, {Line Color( 0 )}, Item ID( "Upper", 1 ) )
)}
),
Dispatch(
{},
"Graph Builder",
FrameBox,
{Add Graphics Script(
2,
Description( "Script" ),
dt = Current Data Table();
yMatrix = dt:upper << get values |/
Matrix( Reverse( As List( dt:lower << get values ) ) );
xMatrix = dt:index << get values |/
Matrix( Reverse( As List( dt:index << get values ) ) );
Fill Color( "yellow" );
Polygon( xMatrix, yMatrix );
), Grid Line Order( 1 ), Reference Line Order( 3 )}
)
)
);
```

Jim

6 REPLIES

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

A week ago
(362 views)

You can add any kind of graphics to your Graph Builder output by adding an

Add Graphics Script

item to your platform. See the script below:

```
dt=current data table();
Graph Builder(
Size( 531, 454 ),
Show Control Panel( 0 ),
Variables(
X( :Index ),
Y( :Point estimate ),
Y( :Lower, Position( 1 ) ),
Y( :Upper, Position( 1 ) )
),
Elements(
Points( X, Y( 1 ), Y( 2 ), Y( 3 ), Legend( 3 ) ),
Line( X, Y( 1 ), Y( 2 ), Y( 3 ), Legend( 5 ) )
),
SendToReport(
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
3,
Base( 0, 0, 0, Item ID( "Point estimate", 1 ) ),
Base( 1, 0, 0, Item ID( "Lower", 1 ) ),
Base( 2, 0, 0, Item ID( "Upper", 1 ) ),
Properties( 0, {Line Color( 0 )}, Item ID( "Point estimate", 1 ) ),
Properties( 1, {Line Color( 0 )}, Item ID( "Lower", 1 ) ),
Properties( 2, {Line Color( 0 )}, Item ID( "Upper", 1 ) )
), Legend Model(
5,
Properties( 0, {Line Color( 0 )}, Item ID( "Point estimate", 1 ) ),
Properties( 1, {Line Color( 0 )}, Item ID( "Lower", 1 ) ),
Properties( 2, {Line Color( 0 )}, Item ID( "Upper", 1 ) )
)}
),
Dispatch(
{},
"Graph Builder",
FrameBox,
{Add Graphics Script(
2,
Description( "Script" ),
dt = Current Data Table();
yMatrix = dt:upper << get values |/
Matrix( Reverse( As List( dt:lower << get values ) ) );
xMatrix = dt:index << get values |/
Matrix( Reverse( As List( dt:index << get values ) ) );
Fill Color( "yellow" );
Polygon( xMatrix, yMatrix );
), Grid Line Order( 1 ), Reference Line Order( 3 )}
)
)
);
```

Jim

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

A week ago
(169 views)

Highlighted
You can also do this in graph builder by using Areas with the range option. Just add your UCL, Estimate, & LCL to the Y-axis. Add the Area graph by dragging the icon into the graph area. Then change the Area style to Range in the controls on the left. Below the missing factors drop down is an outline item for variables. Open the outline item and uncheck the Estimate. The will make the range shown based on the UCL and LCL. If the range is over the lines in your graph you can right click on the range in the graph, select Area > Move Backward. From there you can adjust colors, transparency, etc. by double-clicking on the legend.

M

M

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

A week ago
(155 views)

M

M

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

A week ago
(151 views)

Much better than my solution.........one learns something new in JMP every day

Jim

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

A week ago
(144 views)

@txnelson: Different solutions for different circumstances... :D

... and I'm always in favor of promoting Graphics Scripts and the use of the Customize menu.

M

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

A week ago
(147 views)