- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
How to insert data labels in graph builder
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.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to insert data labels in graph builder
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] )
)
)
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to insert data labels in graph builder
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to insert data labels in graph builder
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
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to insert data labels in graph builder
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to insert data labels in graph builder
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to insert data labels in graph builder
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to insert data labels in graph builder
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to insert data labels in graph builder
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
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to insert data labels in graph builder
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] )
)
)
);