cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
neelsrejan
Level III

Dynamic Reference Line in Variability chart based on value in reference table

Hi all,

 

I am wondering how I can reference a value in a specific column based on a reference column. The concept is just like VLOOKUP in Excel. I have a data table with a name and there is a unique threshold value for that specific name. 

 

Variability Chart(
	Y( :Signal ),
	X( :Expected Outcome, :Sample Mix, :Consumable ),
	Max Iter( 100 ),
	Conv Limit( 0.00000001 ),
	Number Integration Abscissas( 128 ),
	Number Function Evals( 65536 ),
	Analysis Type( Name( "Choose best analysis (EMS REML Bayesian)" ) ),
	Process Variation( 0 ),
	Show Range Bars( 0 ),
	Show Cell Means( 0 ),
	Std Dev Chart( 0 ),
	Points Jittered( 1 ),
	Show Box Plot Whisker Bars( 0 ),
	Mean Diamonds( 0 ),
	By( :Description ),
	SendToReport(
		Dispatch(
			{"Variability Chart for Signal"},
			"2",
			ScaleBox,
			{Scale( "Log" ), Min( 0.01 ), Max( 1250 ), Inc( 1 ), Minor Ticks( 8 ), Add Ref Line( 0, Dotted, "Medium Light Gray" ),
			Add Ref Line( ***[5/(I want this to be the value based on the By reference in the variability chart]***, Dotted, "Black" ), Rotated Labels( "Horizontal" )}
		)
	)
);

In my head it would be get the current value of :Description in the By grouping and then find the corresponding value of the threshold in the "Threshold (nA)" column. But I am unsure how to do this. 

 

A simpler example is:

Example Data table:

A  B  C

1  2  3

1  4  3

2  6  5

2  7  5

3  4  4

4  9  4

 

My variability graph will be plotting B as the y axis but I want a horizontal line based on My By which in this case would be A so 1, 2, 3. So my three variability graphs will have 3, 5, and 4 as respective horizonal lines based on the value of A. As of now I am unsure how to get this value and plug it into the code above to get a dynamic horizonal line by description as my By grouping. Any help would be greatly appreciated. Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Dynamic Reference Line in Variability chart based on value in reference table

Here is a little example of one way to add the reference line based upon a separate column

names default to here(1);
dt = 
// Open Data Table: Big Class.jmp
// → Data Table( "Big Class" )
Open( "$SAMPLE_DATA/Big Class.jmp" );

// Add a column that has the value for the reference line to be written
dt << new column("Ref", set each value(If(:sex=="F", 60,65)));

vc = Variability Chart(
	Y( :height ),
	Model( "Main Effect" ),
	X( :age ),
	by( :sex )
);

summarize( dt, group = by( :sex), value = mean(:ref));

for each( {bygroup,i}, value,
	report(vc[i])[AxisBox(1)] << add ref line(value[i],"solid","red", format(value[i], "fixed dec", 6,1))
);
Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: Dynamic Reference Line in Variability chart based on value in reference table

Here is a little example of one way to add the reference line based upon a separate column

names default to here(1);
dt = 
// Open Data Table: Big Class.jmp
// → Data Table( "Big Class" )
Open( "$SAMPLE_DATA/Big Class.jmp" );

// Add a column that has the value for the reference line to be written
dt << new column("Ref", set each value(If(:sex=="F", 60,65)));

vc = Variability Chart(
	Y( :height ),
	Model( "Main Effect" ),
	X( :age ),
	by( :sex )
);

summarize( dt, group = by( :sex), value = mean(:ref));

for each( {bygroup,i}, value,
	report(vc[i])[AxisBox(1)] << add ref line(value[i],"solid","red", format(value[i], "fixed dec", 6,1))
);
Jim
neelsrejan
Level III

Re: Dynamic Reference Line in Variability chart based on value in reference table

Thanks txnelson,  

 

I didn't properly understand how to use the bygroup in a for each function. Thanks for the code snippet, this is exactly what I was hoping for. I appreciate the help!

 

Respectfully, 

Neel Srejan