cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
jofu
Level I

HELP!? How to add sample size and % above USL and below LSL in graph builder?

I have plotted 2 data sets in graph builder that looks like this:

Screen Shot 2018-02-21 at 9.57.31 AM.png

The USL and LSL were automatically placed via the spec limits I set in the column properties and adding refrences lines to graph. I then additionally added a Marginal USL (MUSL) manually in graph builder. 

 

To this graph, I would like to add a label or note with the count/sample size for each data set as well as the % of points above USL, above MUSL and below LSL. I would like this "label" to be automatically updated everytime i change the data. How can I do this?

4 REPLIES 4
Jeff_Perkinson
Community Manager Community Manager

Re: HELP!? How to add sample size and % above USL and below LSL in graph builder?

@jofu, it looks like your image didn't get attached properly.

Be sure to use the SafariScreenSnapz386.pngbutton in the toolbar in the editor to embed your image.

 

-Jeff
jofu
Level I

Re: HELP!? How to add sample size and % above USL and below LSL in graph builder?

Screen Shot 2018-02-21 at 9.57.31 AM.png

cwillden
Super User (Alumni)

Re: HELP!? How to add sample size and % above USL and below LSL in graph builder?

Hi @jofu,

Welcome to the community!

The embedded image in your post is not showing, so I'm flying a little blind here. I'm guessing you can probably do what you want using Add Text Annotation. Here's an example:

dt = Open("$Sample_Data/Big Class.jmp");

USL = 68;
LSL = 55;
MUSL = 67;

SampleSize = N Row(dt << Get Rows Where(:Sex == "M"));
AboveUSL = Round(100*N Row(dt << Get Rows Where(:Sex == "M" & :height > USL))/SampleSize,2);
BelowLSL = Round(100*N Row(dt << Get Rows Where(:Sex == "M" & :height < LSL))/SampleSize,2);
AboveMUSL = Round(100*N Row(dt << Get Rows Where(:Sex == "M" & :height > MUSL))/SampleSize,2);

text_str = Eval Insert(
"Male Data
Sample Size: ^SampleSize^
Above USL: ^Above USL^%
Above MUSL: ^AboveMUSL^%
Below USL: ^BelowLSL^%"
);

gb = dt << Graph Builder(
	Size( 518, 452 ),
	Show Control Panel( 0 ),
	Variables( X( :height ), Y( :sex ) ),
	Elements( Histogram( X, Y, Legend( 6 ) ) ),
) << Report;

gb << Add Text Annotation(
	Text(text_str),
	Text Box( {80, 60, 127, 281} )
);

And here's what that looks like:Annotate.PNG

 

 

You'll have to play with coordinates for the text box a bit.  I only worked with the first 2 to get the annotation approximately where I wanted.  You could do this in some kind of loop.  My concern with this approach is that the placement of the annotation is not very robust.  It would be nice if you could pin it to a corner of plot or something.

-- Cameron Willden
txnelson
Super User

Re: HELP!? How to add sample size and % above USL and below LSL in graph builder?

You can "Add Graphics Script" to the graph, where you can perform your calculations and display the results in most any format you desire.  Here is a sample

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
dt:height << set property(
	"spec limits",
	{LSL( 55 ), USL( 65 ), Show Limits( 1 )}
);
gb = Graph Builder(
	Size( 534, 448 ),
	Show Control Panel( 0 ),
	Variables( X( :sex ), Y( :height ) ),
	Elements( Points( X, Y, Legend( 5 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"height",
			ScaleBox,
			{Add Ref Line( 58, "Solid", "Black", "MUSL", 1 )}
		)
	)
);
Report( gb )[FrameBox( 1 )] << Add Graphics Script(
	
Jim