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
- :
- Shading in an area on a time-series chart

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
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Aug 28, 2017 7:39 AM
(4177 views)

Dear all,

If I plot a simple time-series of my data I will often gain insight from control limits and also spec limits on the graph. (Simple visualisations of the Voice of the Process and the Voice of the Customer).

With control charts we can "Shade Zones" which can help - I like this feature.

Is there a simple way to do something similar using Graph Builder?

In the attached file it is easy enough to add a pair of horizontal lines which you find at -3 and +3. Is there a simple way using scripting to shade in between two such horizontal lines? How would I shade in the area between -3 and +3 on such a graph to show this is a region to focus on when making sense of the data?

Would be great if somebody could pass on some advice.

Scott.

1 ACCEPTED SOLUTION

Accepted Solutions

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

Through JSL you can add a graphics script to customise the graph, so that it shows a shaded polygon:

```
gb = Graph Builder(
Size( 1659, 932 ),
Show Control Panel( 0 ),
Variables( X( :Series ), Y( :Data ) ),
Elements( Points( X, Y, Legend( 5 ) ) ),
SendToReport(
Dispatch(
{},
"Series",
ScaleBox,
{Min( 0 ), Max( 102 ), Inc( 10 ), Minor Ticks( 1 )}
),
Dispatch(
{},
"Data",
ScaleBox,
{Min( -4 ), Max( 4 ), Inc( 1 ), Minor Ticks( 1 ),
Add Ref Line( 3, "Solid", "Black", "", 1 ),
Add Ref Line( -3, "Solid", "Black", "", 1 )}
)
)
);
// create a shaded region
rep = gb << Report;
x = {};
x[1] = rep[AxisBox(1)] << Get Min;
x[2] = rep[AxisBox(1)] << Get Max;
x[3] = x[2];
x[4] = x[1];
y = {-3,-3,3,3};
fb = rep[FrameBox(1)];
fb << Add Graphics Script(
Transparency(0.1);
Fill Color("Green");
Polygon( Matrix(x), matrix(y) )
);
```

-Dave

5 REPLIES 5

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

Through JSL you can add a graphics script to customise the graph, so that it shows a shaded polygon:

```
gb = Graph Builder(
Size( 1659, 932 ),
Show Control Panel( 0 ),
Variables( X( :Series ), Y( :Data ) ),
Elements( Points( X, Y, Legend( 5 ) ) ),
SendToReport(
Dispatch(
{},
"Series",
ScaleBox,
{Min( 0 ), Max( 102 ), Inc( 10 ), Minor Ticks( 1 )}
),
Dispatch(
{},
"Data",
ScaleBox,
{Min( -4 ), Max( 4 ), Inc( 1 ), Minor Ticks( 1 ),
Add Ref Line( 3, "Solid", "Black", "", 1 ),
Add Ref Line( -3, "Solid", "Black", "", 1 )}
)
)
);
// create a shaded region
rep = gb << Report;
x = {};
x[1] = rep[AxisBox(1)] << Get Min;
x[2] = rep[AxisBox(1)] << Get Max;
x[3] = x[2];
x[4] = x[1];
y = {-3,-3,3,3};
fb = rep[FrameBox(1)];
fb << Add Graphics Script(
Transparency(0.1);
Fill Color("Green");
Polygon( Matrix(x), matrix(y) )
);
```

-Dave

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

Re: Shading in an area on a time-series chart

David - Thanks!

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

Re: Shading in an area on a time-series chart

As a non-scripting alternative for those with JMP version 12 or higher, there is an option for allowing ranges for reference lines in the Y-axis Settings dialog (double-click the y-axis). Checking the "Allow Ranges" box will provide number boxes for inputting the min and max of the range and will allow you to choose a color for that range.

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

Re: Shading in an area on a time-series chart

Nice one Jerry, not seen that check box before.

The code example that I provide I usually use for confidence intervals, but for a rectangular range, like you said can be done interactively, or can be done like this:

```
rep = gb << Report;
rep[AxisBox(2)] << Add Ref Line( {-3, 3}, "Solid", "Medium Light Green", "", 1, 0.25 );
```

-Dave

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

Re: Shading in an area on a time-series chart

Thanks, Jerry. This is a great option which I didn't know about. I've already used it a few times!