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
- :
- How do I make a customised graph?

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

Aug 22, 2017 10:19 AM
(460 views)

Dear community,

I was looking for a histogram of a "variable" overlaid with "defects". For this I have made bins in "Variable_coded" column by using formula.

Next I have used graph builder, "Variable_coded" as X and overlaid "Output". I am also using "time" in data filter.

I have tried option "label by value". However, I want the graph builder to label Percentage against the "total within bin" on top of each bar.

Is it also possible to have total values in background which changes dynamically as I use filter. In other words, I want to merge these two graphs.

Thanks

```
dt = open("$Desktop\SampleData_Bt1.jmp");
dt << New Column( "Variable_coded",
Character,
"Nominal",
Formula(
List = {"20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35",
"36", "37", "38", "39", "40"}[Loc Sorted(
[20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40],
:Variable
)]
),
);
dt << select where (:Output == "GOOD");
dt << hide and exclude;
dt << Graph Builder(
Size( 1072, 922 ),
Lock Scales( 1 ),
Variables( X( :Variable_coded ), Overlay( :Output ) ),
Elements(
Bar( X, Legend( 10 ), Label( "Label by Value" ) ),
Caption Box( X, Legend( 11 ), Summary Statistic( "N" ) )
),
Local Data Filter(
Add Filter( columns( :time ), Where( :time >= 117.31 & :time <= 124.29 ) )
),
SendToReport(
Dispatch(
{},
"Variable_coded",
ScaleBox,
{Min( -0.5 ), Max( 17.5 ), Inc( 1 ), Minor Ticks( 0 )}
),
Dispatch(
{},
"",
ScaleBox,
{Min( 0 ), Max( 500 ), Inc( 50 ), Minor Ticks( 0 )}
),
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
10,
Properties(
2,
{Fill Color( 57 ), gradient(
{Scale Values( [0 1] ), Width( 9 ), N Labels( 6 )}
)}
)
)}
)
)
);
dt<<Graph Builder(
Size( 534, 463 ),
Show Control Panel( 0 ),
Lock Scales( 1 ),
Variables( X( :Variable_coded ) ),
Elements( Bar( X, Legend( 7 ) ) ),
Local Data Filter(
Add Filter( columns( :time ), Where( :time >= 117.31 & :time <= 124.29 ) )
),
SendToReport(
Dispatch(
{},
"Variable_coded",
ScaleBox,
{Min( -0.5 ), Max( 17.5 ), Inc( 1 ), Minor Ticks( 0 )}
),
Dispatch(
{},
"",
ScaleBox,
{Min( 0 ), Max(500 ), Inc( 50 ), Minor Ticks( 1 )}
),
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
7,
Properties(
0,
{Fill Color( 32 ), gradient(
{Scale Values( [0 1] ), Width( 9 ), N Labels( 6 )}
)}
)
)}
)
)
)
```

1 REPLY

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

Sep 6, 2017 2:01 PM
(335 views)

so, first of all, cool data set thanks for posting it.

For the overlay histogram graph like this:

I put the variable on the X axis and put the output in the overlay role. Then selected the histogram graph element.

```
Graph Builder(
Show Control Panel( 0 ),
Variables( X( :Variable ), Overlay( :Output ) ),
Elements( Histogram( X, Legend( 6 ) ) )
)
```

The rest of your question is where I think things get harder.

I used an add-in called Inveractive Binnin v2. and divided the data into pentiles, 10 groups with roughly the same number of rows.

The add-in lets me save the bins to the data table.

Then I used Analyze/Tabulate to make this table

```
Tabulate(
Show Control Panel( 0 ),
Add Table(
Column Table( Grouping Columns( :Output ), Statistics( Row % ) ),
Row Table( Grouping Columns( :Variable Groups ) )
)
)
//:Variable Groups is the column generated from the interactive binning add-in
```

I made the tabulate table into a data table and stacked the defect types.

So now I have a table with a column for the variable groups, a column for the percent of the variable group that is each type of defect, and a column with the defect or good label. (three columns).

This lets me construct this graph.

```
Graph Builder(
Size( 966, 489 ),
Show Control Panel( 0 ),
Variables( X( :Variable Groups ), Y( :Data ), Overlay( :Label ) ),
Elements(
Bar( X, Y, Legend( 5 ), Bar Style( "Stacked" ), Label( "Label by Value" ) )
)
)
```

I'm not quite sure if this is where you were going but its a little closer. Maybe?

x