cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Image to Table JMP extension imports single or batch images as data tables. Useful to extract curves from pictures or convert image data to curve data to use in analyses like Functional Data Explorer. Download and install the extension.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
speleogen
Level I

How to plot a normal curve on a histogram

Back in 2017, txnelson posted a nice snippet of code to do this:

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\Big Class.jmp" );

Dis = dt << Distribution(
	Continuous Distribution( Column( :height ), Vertical( 0 ), Density Axis( 1 ) )
);

Report( Dis )[Frame Box( 2 )] << Add Graphics Script(
	mu = 63;
	sigma = 3.2;
	Pen Color( "Red" );
	Y Function( Normal Density( (x - mu) / sigma ) / (40 / 12), x );

	mu = 51.5;
	sigma = .87;
	Pen Color( "Blue" );
	Y Function( Normal Density( (x - mu) / sigma ) / (40 / 2), x );
);

To scale the curve properly, you need the total number of data points divided by the data points for the maximum bar in the histogram distribution (here shown as 40/12 and 40/2) . Is there a way to calculate these? I can get the former, but not the latter.

 

Thanks for any help,

John

1 REPLY 1

Re: How to plot a normal curve on a histogram

I do not know how to get the counts but assuming that the scale is appropriate, you could ask the Axis Box for the Maximum scale value with the << Get Max message.

Recommended Articles