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
Agustin
Level IV

Change graph background colour between reference lines

Hi, I have a scatter plot with a line of best fit to which I've added 2 reference lines to the x-axis.

Is there an easy way of changing the background of the area between both reference lines to light-grey.

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Change graph background colour between reference lines

One option is to use some scripting and add graphic script

Names Default To Here(1);

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

gb = dt << Graph Builder(
	Variables(X(:weight), Y(:height)),
	Elements(Points(X, Y, Legend(3))),
	SendToReport(
		Dispatch(
			{},
			"height",
			ScaleBox,
			{Add Ref Line(65, "Solid", "Black", "", 1),
			Add Ref Line(55, "Solid", "Black", "", 1)}
		)
	)
);

rep = gb << report;
framebox = rep[frame box(1)];
framebox << Add Graphics Script(
	Transparency(0.5);
	Fill Color("Gray");
	Rect(X Origin(), 65, X Origin() + X Range(), 55, 1)
);
-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: Change graph background colour between reference lines

One option is to use some scripting and add graphic script

Names Default To Here(1);

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

gb = dt << Graph Builder(
	Variables(X(:weight), Y(:height)),
	Elements(Points(X, Y, Legend(3))),
	SendToReport(
		Dispatch(
			{},
			"height",
			ScaleBox,
			{Add Ref Line(65, "Solid", "Black", "", 1),
			Add Ref Line(55, "Solid", "Black", "", 1)}
		)
	)
);

rep = gb << report;
framebox = rep[frame box(1)];
framebox << Add Graphics Script(
	Transparency(0.5);
	Fill Color("Gray");
	Rect(X Origin(), 65, X Origin() + X Range(), 55, 1)
);
-Jarmo

Re: Change graph background colour between reference lines

You can also use a reference region. The region is independent of the lines. You can use either one or both of them.

 

Names Default To Here( 1 );

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

gb = dt << Graph Builder(
	Variables( X( :weight ), Y( :height) ),
	Elements( Points( X, Y, Legend( 3 ) ) )
);

rpt = gb << Report;

rpt[AxisBox(2)]
	<< Add Ref Line( 55, "Solid", "Black", "", 1 )
	<< Add Ref Line( 65, "Solid", "Black", "", 1 )
	<< Add Ref Line( { 55, 65 }, "Solid", "Green", "", 1, 0.25 );