cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
UserID16644
Level V

Plotting with lower and upper limits

Hi all,

I have a function that creates cdf plots with lower and upper limits. However, when applied, the lower/upper limits are not being shown because of the axis minimum and maximum. What/how is the proper computation in order for the lower and upper limit to be shown from the plots?

 

Here is my sample function:

cdfplot = Function( {ycol, sl, ul}, {plot}, 
									
					cdf = Oneway( Y( Column( ycol ) ), X( :Lot ), Means and Std Dev( 1 ), Box Plots( 1 ), Mean Diamonds( 1 ), Mean Error Bars( 1 ),
					Std Dev Lines( 1 ), Comparison Circles( 0 ), Connect Means( 1 ), X Axis Proportional( 0 ), Points Jittered( 1 ), Grand Mean( 0 ));
					rcdf = cdf << report;
					
					//Convert rcdf to list if not list
					If( Not( Is List( rcdf ) ),
							rcdf = Eval List({rcdf});
						);
					
					//Apply customization to cdf								
					For( s = 1, s <= Nitems(rcdf), s++,
					
						Try( cmin = rcdf[s][axis box( 1 )] << Get Min() );
						Try( cmax = rcdf[s][axis box( 1 )] << Get Max() );
	
						rcdf[s][FrameBox( 1 )] << {Frame Size( 380, 250 ), Marker Size( 3 ), Line Width Scale( 1.5 )};
						rcdf[s][Text Edit Box( 1 )] << Set Font Size( 10 ) << Set Font Style( "Bold" );
						rcdf[s][Text Edit Box( 2 )] << Set Font Size( 10 ) << Set Font Style( "Bold" );
						rcdf[s][axis box( 2 )] << Format( "Best", 12 ) << Tick Font( style( 1 ), size( 9 ) ) << Show major Grid( 1 ) << Show Minor Grid( 1 ) <<
						Show Minor Ticks( 1 ) << Minor Ticks( 4 );
						Try( rcdf[s][axis box( 1 )] << Max(cmax) << Min(cmin) << Inc() << Minor Ticks( 1 ) );
						rcdf[s][axis box( 1 )] << Format( "Best", 12 ) << Tick Font( style( 1 ), size( 9 ) ) << Show major Grid( 1 ) << Show Minor Grid( 1 ) <<
						Show Minor Ticks( 1 ) << Minor Ticks( 4 );
						rcdf[s][Scale box ( 3 )] << Add Ref Line( ul, "Solid", "Red", "USL", 2 ) << Add Ref Line( sl, "Solid", "Red", "LSL", 2 );
					);
					plot = rcdf;
);


//Function application
colname = {"AVG_1", "AVG_2", "AVG_3"};
ul = {11.5, "20", "100"};
ll = {8, 0.1, 6 };

lb = Lineup Box( N Col(4) );
For( i = 1, i <= N Items( colname ), i++,
	lb << Append( H List Box( cdfplot( colname[i], ll[i], ul[i] ) ) )
);

I have this plot as the result:

UserID16644_0-1687423292135.png

 

 

But it should be like this:

UserID16644_2-1687423343796.png

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Plotting with lower and upper limits

Two items

  1. Your ul list has character values instead of numeric values
    ul = {11.5, "20", "100"};

     

  2. You need to check to see if your cmax and cmin are outside of your ul and sl values and if so, then reset their values.
    Try( cmin = rcdf[s][axis box( 1 )] << Get Min() );
    		Try( cmax = rcdf[s][axis box( 1 )] << Get Max() );
    		
    		range = abs(cmax-cmin);
    		if(sl<cmin, cmin =sl-.1*range);
    		if(ul>cmax,cmax=ul+.1*range);
Jim

View solution in original post

1 REPLY 1
txnelson
Super User

Re: Plotting with lower and upper limits

Two items

  1. Your ul list has character values instead of numeric values
    ul = {11.5, "20", "100"};

     

  2. You need to check to see if your cmax and cmin are outside of your ul and sl values and if so, then reset their values.
    Try( cmin = rcdf[s][axis box( 1 )] << Get Min() );
    		Try( cmax = rcdf[s][axis box( 1 )] << Get Max() );
    		
    		range = abs(cmax-cmin);
    		if(sl<cmin, cmin =sl-.1*range);
    		if(ul>cmax,cmax=ul+.1*range);
Jim