cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to create experiments to support product design and ID useful product features. Register for June 12 webinar, 2pm US Eastern Time.

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