cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar

Adding multiple horizonal reference lines based on columns

Hello, 

I'm having trouble adding a horizontal reference line in my plot based on a column parameter. The code is attached below. I need the reference line to be a horizontal line not a vertical line: 

Names Default to Here( 1 );
quantile_plot = Graph Builder(
	Size( 528, 631 ),
	Show Control Panel( 0 ),
	Variables( X( :Dataset ), Y( :y ), Color( :SAMPLEID ) ),
	Elements( Points( X, Y, Legend( 4 ), Jitter( "Random Uniform" ) ) ),
	Local Data Filter(
		Add Filter(
			columns( :Gender, :Ethnicity, :Age, :Congener ),
			Where( :Gender == "1" ),
			Where( :Ethnicity == "3" ),
			Where( :Age == "4" ),
			Where( :Congener == "LBC028" ),
			Display( :Ethnicity, N Items( 5 ) ),
			Display( :Age, N Items( 4 ) ),
			Display( :Congener, N Items( 15 ), Find( Set Text( "" ) ) )
		)
	),
	SendToReport(
		Dispatch(
			{},
			"Dataset",
			ScaleBox,
			{Add Ref Line( -0.5, "Solid", "Red", "", 2 )}
		),
		Dispatch(
			{},
			"y",
			ScaleBox,
			{Scale( "Log" ), Format( "Best", 6 ), Min( 0.261333735635329 ),
			Max( 20 ), Inc( 1 ), Minor Ticks( 1 )}
		)
	)
);
report(quantile_plot)[axisbox(2)] << Add Ref Line( threshold, "solid", black, "", 2 );

report(quantile_plot)[axisbox(2)]<<  min(threshold);

 

MikeDereviankin_0-1649011473283.png

 

M. Dereviankin
2 REPLIES 2

Re: Adding multiple horizonal reference lines based on columns

Does the reference line appear if you translate or scale the Y axis to decrease the minimum value shown?  Since your script sets the min to the same value as the reference line, I would be concerned that numerical issues may cause the reference line to be clipped from view.

Re: Adding multiple horizonal reference lines based on columns

The line needs to be horizontal based on the value that is listed for, 'threshold'. I want these so I can automatically create a data filter and see how this line changes. 

M. Dereviankin