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
- :
- How to insert data labels in 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

Nov 3, 2016 12:21 PM
(10413 views)

Can someone please tell me how to insert data labels in Confidence interval plots and control chart averages of Jmp12? See the attached image for better clarification.

1 ACCEPTED SOLUTION

Accepted Solutions

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

Here is the simple script to give you a start. It can be made far more fancy, but this should give you a start:

```
Names Default To Here( 1 );
dt = Current Data Table();
// Calculate the means so they can be displayed
Summarize( dt, bygroup = by( :Name( "Factor-1" ) ), themeans = Mean( :thickness ) );
// Run the basic graph builder code
gb = dt << Graph Builder(
Variables( X( :Name( "Factor-1" ) ), Y( :Thickness ) ),
Elements( Points( X, Y, Legend( 5 ), Summary Statistic( "Mean" ), Error Bars( "Confidence Interval" ) ) )
);
// Loop across the different factors and add the mean as a text
// Note, that because the x axis values are based upon a character column,
// the X position is 0 for the first group, 1 for the second, etc.
For( i = 1, i <= N Items( bygroup ), i++,
Eval(
Substitute(
Expr(
Report( gb )[framebox( 1 )] << add graphics script( Text( {__x__, __y__}, __mean__ ) )
),
Expr( __x__ ), i-1 + .1,
Expr( __y__ ), themeans[i],
Expr( __mean__ ), Char( Themeans[i] )
)
)
);
```

Jim

8 REPLIES

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

Are you asking how to interactively add labels to the chart?

Since the Mean and Confidence Intervals are calculated values, you can not use the Row State Label options to display the values. You can right click on the graph, and add a caption box, however, the stats displayed there are overall stats. What you will need to do is to go to the Drawing tools and select a text entry box, and to add it manually to the graph.

Jim

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

Thanks Jim.

It looks like that I have to manually calculate stat for each factor and insert in a caption box!

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

A script can be written to handle that issue. The summary stats can be calculated and then annotation can be added to the graph that contains the summary information

If you have some sample data I can give you a good start on how to do that.

Jim

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

Thanks! I have attached a simple two factor data table.

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

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

My fault.....there is an issue with the current discussion forum, where you can not attach something after the initial responses. Can you convert it to a script:

Under the "Source" entry in the Tables Panel for the data table, click on it and select

"Copy Table Script"

Then click on the "Insert JSL Code" in your reply and paste the code into it

Jim

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

New Table( "test", Add Rows( 20 ), New Column( "Factor-1", Character, "Nominal", Set Values( {"Factor 1", "Factor 1", "Factor 1", "Factor 1", "Factor 1", "Factor 1", "Factor 1", "Factor 1", "Factor 1", "Factor 1", "Factor 2", "Factor 2", "Factor 2", "Factor 2", "Factor 2", "Factor 2", "Factor 2", "Factor 2", "Factor 2", "Factor 2"} ) ), New Column( "Thickness", Numeric, "Continuous", Format( "Best", 11 ), Set Selected, Set Values( [1.50740933, 1.601142469, 1.074704843, 1.884292315, 1.012608931, 1.607336196, 1.832731982, 1.269104476, 1.652280427, 1.729379409, 0.195244429, 0.764830482, 0.401538929, 0.890074236, 0.395640352, 0.896762654, 0.389728401, 0.223935429, 0.165762602, 0.414394237] ) ), Set Row States( [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] ) )

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

Here is the simple script to give you a start. It can be made far more fancy, but this should give you a start:

```
Names Default To Here( 1 );
dt = Current Data Table();
// Calculate the means so they can be displayed
Summarize( dt, bygroup = by( :Name( "Factor-1" ) ), themeans = Mean( :thickness ) );
// Run the basic graph builder code
gb = dt << Graph Builder(
Variables( X( :Name( "Factor-1" ) ), Y( :Thickness ) ),
Elements( Points( X, Y, Legend( 5 ), Summary Statistic( "Mean" ), Error Bars( "Confidence Interval" ) ) )
);
// Loop across the different factors and add the mean as a text
// Note, that because the x axis values are based upon a character column,
// the X position is 0 for the first group, 1 for the second, etc.
For( i = 1, i <= N Items( bygroup ), i++,
Eval(
Substitute(
Expr(
Report( gb )[framebox( 1 )] << add graphics script( Text( {__x__, __y__}, __mean__ ) )
),
Expr( __x__ ), i-1 + .1,
Expr( __y__ ), themeans[i],
Expr( __mean__ ), Char( Themeans[i] )
)
)
);
```

Jim