Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
estesmd1981
Level I

Overlay histogram and cdf on single plot with separate editable y-axis ranges

I can create histograms and cdfs seperately using the distribution tool.  I can even overlay them on one graph if I copy and paste frame contents between the two graphs, but at this point the cdf is cropped and does not display correctly.  Is there an easier way to do this?

 

Screen Shot 2018-08-22 at 10.02.41 AM.jpgScreen Shot 2018-08-22 at 10.02.53 AM.jpgScreen Shot 2018-08-22 at 10.03.09 AM.jpg

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
gzmorgan0
Super User

Re: Overlay histogram and cdf on single plot with separate editable y-axis ranges

There might be an easier method, but I create a Summary table of the response returning the % of Total. Then compute the **bleep** Percent then graph the Count and **bleep** percent as 2 Y vaariables, making the **bleep** Percent the right axis.

 

Here is the method using a script, below is the resulting picture

 

Names Default to Here(1);

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

dtsum = dt << Summary(
	Group( :height ),
	Name( "% of Total" )(:height),
	Freq( "None" ),
	Weight( "None" )
);

dtsum:N Rows << set name("Count");
cumcol = dtsum << New Column("**bleep** Sum", Numeric, Continuous, 
		Format( "Percent", 12, 1 ),
		Formula(
			If( Row() == 1,
				:Name( "% of Total(height)" ),
				:Name( "% of Total(height)" ) + Lag( :**bleep** Sum, 1 )
			)
		),

); 

 gb = dtsum << Graph Builder(
	Size( 534, 448 ),
	Show Control Panel( 0 ),
	Variables(
		X( :height ),
		Y( :**bleep** Sum, Side( "Right" ) ),
		Y( :Name( "% of Total(height)" ), Position( 1 ) )
	),
	Elements(
		Bar( X, Y( 2 ), Legend( 17 ) ),
		Points( X, Y( 1 ), Legend( 14 ) ),
		Smoother( X, Y( 1 ), Legend( 15 ) )
	),
	SendToReport(
		Dispatch(
			{},
			"**bleep** Sum",
			ScaleBox,
			{Format( "Percent", 12, 1 ), Min( 0 ), Max( 1.02551020408163 ),
			Inc( 0.1 ), Minor Ticks( 1 )}
		),
		Dispatch(
			{},
			"400",
			LegendBox,
			{Legend Position( {17, [2], 14, [0], 15, [1]} ), Position( {2, 0, 1} )}
		)
	)
);

 

image.png

View solution in original post

2 REPLIES 2
Highlighted
gzmorgan0
Super User

Re: Overlay histogram and cdf on single plot with separate editable y-axis ranges

There might be an easier method, but I create a Summary table of the response returning the % of Total. Then compute the **bleep** Percent then graph the Count and **bleep** percent as 2 Y vaariables, making the **bleep** Percent the right axis.

 

Here is the method using a script, below is the resulting picture

 

Names Default to Here(1);

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

dtsum = dt << Summary(
	Group( :height ),
	Name( "% of Total" )(:height),
	Freq( "None" ),
	Weight( "None" )
);

dtsum:N Rows << set name("Count");
cumcol = dtsum << New Column("**bleep** Sum", Numeric, Continuous, 
		Format( "Percent", 12, 1 ),
		Formula(
			If( Row() == 1,
				:Name( "% of Total(height)" ),
				:Name( "% of Total(height)" ) + Lag( :**bleep** Sum, 1 )
			)
		),

); 

 gb = dtsum << Graph Builder(
	Size( 534, 448 ),
	Show Control Panel( 0 ),
	Variables(
		X( :height ),
		Y( :**bleep** Sum, Side( "Right" ) ),
		Y( :Name( "% of Total(height)" ), Position( 1 ) )
	),
	Elements(
		Bar( X, Y( 2 ), Legend( 17 ) ),
		Points( X, Y( 1 ), Legend( 14 ) ),
		Smoother( X, Y( 1 ), Legend( 15 ) )
	),
	SendToReport(
		Dispatch(
			{},
			"**bleep** Sum",
			ScaleBox,
			{Format( "Percent", 12, 1 ), Min( 0 ), Max( 1.02551020408163 ),
			Inc( 0.1 ), Minor Ticks( 1 )}
		),
		Dispatch(
			{},
			"400",
			LegendBox,
			{Legend Position( {17, [2], 14, [0], 15, [1]} ), Position( {2, 0, 1} )}
		)
	)
);

 

image.png

View solution in original post

Highlighted
gzmorgan0
Super User

Re: Overlay histogram and cdf on single plot with separate editable y-axis ranges

Too funny!

 

I abbreviated Cumulative Sum in my attached script and previous post), and the JMP blog converted it to "** bleep** Sum"  when I posted it. Make the changes accordingly.

 

Article Labels

    There are no labels assigned to this post.