cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Image to Table JMP extension imports single or batch images as data tables. Useful to extract curves from pictures or convert image data to curve data to use in analyses like Functional Data Explorer. Download and install the extension.

Discussions

Solve problems, and share tips and tricks with other JMP users.
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 );

Recommended Articles