cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

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