<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />Hi, JMP experts,
I have a table like this:
School Var1 Var2 Var3 ..... VarN
Sch_A .....
Sch_B .....
Sch_C ....
...
I tried to make X-Y Scatter plot and then group them by "School", then add fit lines using JMP scripts.
Here is the code I copied:
Bivariate(
Y( :Var2 ),
X( :Var1 ),
Fit Where(
:School == "Sch_A",
Fit Spline( 2, Standardized, {Line Color( {42, 63, 255} )} )
),
Fit Where(
:School == "Sch_B",
Fit Spline( 2, Standardized, {Line Color( {23, 138, 138} )} )
),
Fit Where(
:School == "Sch_C",
Fit Spline( 2, Standardized, {Line Color( {121, 123, 5} )} )
),
Fit Where(
:School == "Sch_D",
Fit Spline( 2, Standardized, {Line Color( {252, 11, 11} )} )
),
SendToReport(
Dispatch(
{},
"Bivar Plot",
FrameBox,
{Row Legend(
School,
Color( 1 ),
Color Theme( "JMP Default" ),
Marker( 0 ),
Marker Theme( "" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
)
)
)
===================
Is it possible to make the blue part more general? Can I use GroupBy, and Color Theme, so I don't need to add the name/color for each group one by one.
Thanks!
Qian
Yes, use Group By(:School) as in the example below. Colors will be set automatically.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
biv=dt << Bivariate(
Y( :height ),
X( :weight ),
group by( :sex ),
Fit Spline( 2, Standardized ),
);
report(biv)[Framebox(1)]<<row legend(sex)