cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Choose Language Hide Translation Bar
lala
Level VIII

When drawing bubbles, how can I set the background color to different colors according to the number of rows?

Hello!

 

For example, set lines 1-20 and 21-40 to different background colors.

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

p1=dt<<Bubble Plot(
	X( Transform Column( "Row", Formula( Row() ) ) ),
	Y( :height ),
	Sizes( :weight ),
	Coloring( :sex ),
	Title Position( 0, 0 ),
	SendToReport(
		Dispatch(
			{},
			"1",
			ScaleBox,
			{Min( 0 ), Max( 45 ), Inc( 5 ), Minor Ticks( 0 )}
		),
		Dispatch(
			{},
			"2",
			ScaleBox,
			{Min( 50 ), Max( 72.5 ), Inc( 5 ), Minor Ticks( 1 )}
		),
		Dispatch(
			{},
			"Bubble Plot",
			FrameBox,
			{Frame Size( 565, 360 ), Background Color( 76 )}
		)
	)
);

2022-12-10_08-44-26.png

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

回复: When drawing bubbles, how can I set the background color to different colors according to the number of rows?

You could use reference lines with allow range enabled

Names Default To Here(1);

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

bp = dt << Bubble Plot(
	X(Transform Column("Row", Formula(Row()))),
	Y(:height),
	Sizes(:weight),
	Coloring(:sex),
	Title Position(0, 0)
);

wait(1);

axisbox = Report(bp)[axis box(2)];
axisbox << Add Ref Line({0, 20}, "Solid", "Red", "", 1, 0.25);
axisbox << Add Ref Line({20, 40}, "Solid", "Medium Light Blue", "", 1, 0.25);

Or then graphic scripts but I think reference lines with range are easier in this case.

-Jarmo

View solution in original post

3 REPLIES 3
lala
Level VIII

回复: When drawing bubbles, how can I set the background color to different colors according to the number of rows?

Not work.

Fill Color("blue"); Rect( 1, 80 , 20 ,50,  1);,
jthi
Super User

回复: When drawing bubbles, how can I set the background color to different colors according to the number of rows?

You could use reference lines with allow range enabled

Names Default To Here(1);

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

bp = dt << Bubble Plot(
	X(Transform Column("Row", Formula(Row()))),
	Y(:height),
	Sizes(:weight),
	Coloring(:sex),
	Title Position(0, 0)
);

wait(1);

axisbox = Report(bp)[axis box(2)];
axisbox << Add Ref Line({0, 20}, "Solid", "Red", "", 1, 0.25);
axisbox << Add Ref Line({20, 40}, "Solid", "Medium Light Blue", "", 1, 0.25);

Or then graphic scripts but I think reference lines with range are easier in this case.

-Jarmo
lala
Level VIII

回复: When drawing bubbles, how can I set the background color to different colors according to the number of rows?

Thank you for your help!

dt=Open("$SAMPLE_DATA/Big Class.jmp");
bp = dt <<Graph Builder(
	Size( 532, 453 ),
	Show Control Panel( 0 ),
	Variables(
		X( Transform Column( "Row", Formula( Row() ) ) ),
		Y( :height ),
		Color( :sex ),
		Size( :height )
	),
	Elements( Points( X, Y, Legend( 17 ) ) )
);

axisbox = Report(bp)[axis box(1)];
axisbox << Add Ref Line({0, 20}, "Solid", "Red", "", 1, 0.25);
axisbox << Add Ref Line({20, 40}, "Solid", "Medium Light Blue", "", 1, 0.25);