BookmarkSubscribe
Choose Language Hide Translation Bar
AdamChoen
Community Trekker

change legend to existing biv plot

Hi,

i created a biv chart with legend "age", now i want to use the same graph with a different legend.

how can i do it?

 

this is what i try and the error i get.

 

prof=Bivariate( 
	Y( :high),	
	X( :weight),
	by(:country),
	SendToReport(
		Dispatch( {}, "Bivar Plot", FrameBox, {Frame Size( 550, 450 ), 
					Row Legend(
					:age,
					Color( 1 ),
					Color Theme( "JMP Default" ),
					Marker( 1 ),
					Marker Theme( "Alphanumeric" ),
					Continuous Scale( 0 ),
					Reverse Scale( 0 ),
					Excluded Rows( 0 ))
					} )
	)
);
Report( prof )[Frame Box(1)] << Row Legend( “sex”, color(1), marker(1));


Send Expects Scriptable Object{731} in access or evaluation of 'Send' , Report( prof )[Frame Box( 1 )] << /*###*/Row Legend(
"sex",
color( 1 ),
Marker( 1 )
) /*###*/

In the following script, error marked by /*###*/
Report( prof )[Frame Box( 1 )] << /*###*/Row Legend(
"sex",
color( 1 ),
Marker( 1 )
) /*###*/
{}

 

Thanks, Adam
0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
ih
ih
Community Trekker

Re: change legend to existing biv plot

When you add a 'by' to the bivariate analysis a list of objects is returned.  Thus you need to operate on each item in the list.

Names default to here( 1);

dt = Open( "$Sample_data/big class.jmp" );

prof = Bivariate( 
	Y( :height ), 
	X( :weight ), 
	By( age ),
	SendToReport(
		Dispatch(
			{},
			"Bivar Plot",
			FrameBox,
			{Row Legend(
				name,
				Color( 1 ),
				Color Theme( "JMP Default" ),
				Marker( 0 ),
				Marker Theme( "" ),
				Continuous Scale( 0 ),
				Reverse Scale( 0 ),
				Excluded Rows( 0 )
			)}
		)
	)
);

//Note how prof is a list
Show( type( prof ) );
Show( N Items( prof ) );

//Delete the old row legend first
Try( Report( prof[1] )[BorderBox(2)] << Delete );

//Add a new row legend
Report( prof[1] )[Frame Box(1)] << Row Legend(
	sex,
	Color( 1 ),
	Color Theme( "JMP Default" ),
	Marker( 0 ),
	Marker Theme( "" ),
	Continuous Scale( 0 ),
	Reverse Scale( 0 ),
	Excluded Rows( 0 )
);
1 REPLY 1
ih
ih
Community Trekker

Re: change legend to existing biv plot

When you add a 'by' to the bivariate analysis a list of objects is returned.  Thus you need to operate on each item in the list.

Names default to here( 1);

dt = Open( "$Sample_data/big class.jmp" );

prof = Bivariate( 
	Y( :height ), 
	X( :weight ), 
	By( age ),
	SendToReport(
		Dispatch(
			{},
			"Bivar Plot",
			FrameBox,
			{Row Legend(
				name,
				Color( 1 ),
				Color Theme( "JMP Default" ),
				Marker( 0 ),
				Marker Theme( "" ),
				Continuous Scale( 0 ),
				Reverse Scale( 0 ),
				Excluded Rows( 0 )
			)}
		)
	)
);

//Note how prof is a list
Show( type( prof ) );
Show( N Items( prof ) );

//Delete the old row legend first
Try( Report( prof[1] )[BorderBox(2)] << Delete );

//Add a new row legend
Report( prof[1] )[Frame Box(1)] << Row Legend(
	sex,
	Color( 1 ),
	Color Theme( "JMP Default" ),
	Marker( 0 ),
	Marker Theme( "" ),
	Continuous Scale( 0 ),
	Reverse Scale( 0 ),
	Excluded Rows( 0 )
);