cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Choose Language Hide Translation Bar
View Original Published Thread

different spec limits for different variability plots

newbie_4
Level II

Hello,

I am trying to create variability plots and show spec limits with values specified in LCL and UCL columns. I need different spec values for within graph (based on ROUTE_TYPE column, FL and SL have different limits) and for 2nd variability plot (for OVL_UNL parameter, L2_L1 has different FL/SL limits vs L3_L2)

 

newbie_4_0-1654052479783.png

 

newbie_4_1-1654052750239.png

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User


Re: different spec limits for different variability plots

To accomplish this you will need to use << Add Graphics Script to the Variability Chart, that reads the LSL and USL values an then adds them as lines to the chart.  The script below is an example

txnelson_0-1654058179566.png

Names Default To Here( 1 );

dt = New Table( "Example",
	Add Rows( 12 ),
	New Column( "age", "Ordinal", Format( "Fixed Dec", 5, 0 ), Set Values( [12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17] ) ),
	New Column( "sex", Character( 1 ), "Nominal", Set Values( {"F", "M", "F", "M", "F", "M", "F", "M", "F", "M", "F", "M"} ) ),
	New Column( "Height",
		Numeric,
		"Continuous",
		Format( "Fixed Dec", 12, 1 ),
		Set Values( [58.6, 57.3333333333333, 59, 61.25, 62.6, 65.2857142857143, 63, 65.2, 62.5, 68, 62, 69] )
	),
	New Column( "LSL",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [45, 45, 50, 50, 57, 57, 60, 60, 60.5, 60.5, 61, 61] )
	),
	New Column( "USL",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [60, 60, 65, 65, 67, 67, 70, 70, 72, 72, 75, 75] )
	)
);

vc = Variability Chart( Y( :Height ), X( :age, :sex ), Std Dev Chart( 0 ) );
Report( vc )[framebox( 1 )] << add graphics script(
	For( i = 1, i <= N Rows( dt ), i++,
		xstart = (:age[i] - Col Min( :age )) * 2;
		If( :sex[i] == "M",
			xstart = xstart + 1
		);
		Pen Color( blue );
		Pen Size( 2 );
		yMat = Matrix( :LSL[i] || :LSL[i] );
		xMat = Matrix( xstart || xstart + 1 );
		Line( xMat, yMat );
		yMat = Matrix( :USL[i] || :USL[i] );
		Line( xMat, yMat );
	)
);
Jim

View solution in original post

1 REPLY 1
txnelson
Super User


Re: different spec limits for different variability plots

To accomplish this you will need to use << Add Graphics Script to the Variability Chart, that reads the LSL and USL values an then adds them as lines to the chart.  The script below is an example

txnelson_0-1654058179566.png

Names Default To Here( 1 );

dt = New Table( "Example",
	Add Rows( 12 ),
	New Column( "age", "Ordinal", Format( "Fixed Dec", 5, 0 ), Set Values( [12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17] ) ),
	New Column( "sex", Character( 1 ), "Nominal", Set Values( {"F", "M", "F", "M", "F", "M", "F", "M", "F", "M", "F", "M"} ) ),
	New Column( "Height",
		Numeric,
		"Continuous",
		Format( "Fixed Dec", 12, 1 ),
		Set Values( [58.6, 57.3333333333333, 59, 61.25, 62.6, 65.2857142857143, 63, 65.2, 62.5, 68, 62, 69] )
	),
	New Column( "LSL",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [45, 45, 50, 50, 57, 57, 60, 60, 60.5, 60.5, 61, 61] )
	),
	New Column( "USL",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [60, 60, 65, 65, 67, 67, 70, 70, 72, 72, 75, 75] )
	)
);

vc = Variability Chart( Y( :Height ), X( :age, :sex ), Std Dev Chart( 0 ) );
Report( vc )[framebox( 1 )] << add graphics script(
	For( i = 1, i <= N Rows( dt ), i++,
		xstart = (:age[i] - Col Min( :age )) * 2;
		If( :sex[i] == "M",
			xstart = xstart + 1
		);
		Pen Color( blue );
		Pen Size( 2 );
		yMat = Matrix( :LSL[i] || :LSL[i] );
		xMat = Matrix( xstart || xstart + 1 );
		Line( xMat, yMat );
		yMat = Matrix( :USL[i] || :USL[i] );
		Line( xMat, yMat );
	)
);
Jim