cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
MarcP
Level III

How do I get a gradient background in graph builder

I want to create a scatter plot with 9 squares that looks like a McKinsey GE matrix, and plot data points in those squares. If the bottom left equals the lowest values and top right the highest value, I would like to have a gradient diagonal background, starting with red in the lower left corner and green in the top right with a yellow band in the middle (see attached jpg). In excel I can do this in a scatter plot. How do I create this background in graph builder?

2 REPLIES 2
txnelson
Super User

Re: How do I get a gradient background in graph builder

I was able to add the gradient as a background image, and then overlayed data on top of it.  I am using the .jpg that you supplied.  You would need to create a separate image.  I believe that it could be build using a graph box() in JMP.

txnelson_0-1682511472714.png

Here is the JSL

Names Default To Here( 1 );
dt = New Table( "example",
	Add Rows( 7 ),
	New Column( "x",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [0.655, 0.655, 0.655, 1.69, 1.69, 2.715, 2.715] ),
		Set Display Width( 38 )
	),
	New Column( "y",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [9.65, 5.6, 1.52, 5.6, 1.52, 5.6, 1.52] ),
		Set Display Width( 72 )
	),
	New Column( "size",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [20, 20, 20, 20, 20, 20, 20] )
	),
	Set Row States( [8192, 8384, 8384, 8384, 8384, 8384, 8384] )
);

op = Graph Builder(
	Size( 1120, 456 ),
	Show Control Panel( 0 ),
	Variables( X( :x ), Y( :y ), Size( :size ) ),
	Elements( Points( X, Y, Legend( 7 ) ) ),
	SendToReport(
		Dispatch( {}, "x", ScaleBox, {Min( 0.15 ), Max( 3.2 ), Inc( 0.5 ), Minor Ticks( 1 )} ),
		Dispatch(
			{},
			"y",
			ScaleBox,
			{Min( -0.635918367346939 ), Max( 11.6721345272803 ), Inc( 2 ), Minor Ticks( 1 )}
		),
		Dispatch( {}, "400", LegendBox, {Legend Position( {7, [-1, -1]} )} )
	)
);
opr1 = op << report;
opr2 = opr1 << Clone Box;
opr1 << append( opr2 );
fb1 = opr1[Frame Box( 1 )];
fb1 << Add Image(
	Open( Convert File Path( "<path to the image>.jpg" ) ),
	Transparency( 0.9 ),
	Bounds(
		Left( 0.135416666666667 ),
		Right( 3.26041666666667 ),
		Top( 11.8333333333333 ),
		Bottom( -1 )
	),
	SetSize( {300, 210} )
);
fb1 << Copy Picture;
fb2 = opr2[Frame Box( 1 )];
fb2 << Paste Background Image;
Jim
MarcP
Level III

Re: How do I get a gradient background in graph builder

Thanks Jim,

 

Apparently a bit more complex than excel.

 

Marc

Recommended Articles