BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar
Pearl
Occasional Contributor

How do I get the containers of Scatterplot 3D

Hi,

 

When I represent data in a Scatterplot 3D, I repeat some actions frequently. For example, I change the Color Theme (colorbar), the size of the points, etc. Tables are different but actions are the same and they don't refer to specific columns, so I suppose the actions can be automatized.

I wonder how to script this for graphs that are already open. For 2d grahps I can use, for example, this command to refer to the container:

 

Window( Window name )[framebox( 1 )] << set background color( "gray" );

but I cannot use it in a Scatterplot 3D.

 

Thank you,

David

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
julian
Staff

Re: How do I get the containers of Scatterplot 3D

Hi @Pearl,

To tell the platform to dispatch options, you'll need a handle to the scriptable object (the scatterplot 3d platform itself) rather than the report window. We can use <<Get Scriptable Object to help us out here. Once you have that handle, you can send the exact dispatch message you found when you saved the script. Here's a full example of that, including the previous customizations I showed:

Open( "$SAMPLE_DATA\Big Class.jmp" );

s3d = Scatterplot 3D( Y( :age, :height, :weight ), Coloring( :sex ), Legend( 17 ), Frame3D( Legend( 1 ) ) );

//view properties if you wish to see options
//show properties(Window( "Big Class - Scatterplot 3D" )[SceneBox(1)]);
//show properties(Window( "Big Class - Scatterplot 3D" )[Display3DBox(1)]);

//set colors, contolled in the report layer
Window( "Big Class - Scatterplot 3D" )[Display3DBox( 1 )] << Set Wall Color( 5 ); Window( "Big Class - Scatterplot 3D" )[Scene Box( 1 )] << Background color( blue ); //find the scriptable object so that options can be dispatched s3dFound = Window( "Big Class - Scatterplot 3D" )[Outline Box( 1 )] << Get Scriptable Object; //Dispatch options by sending messages to that scriptable object s3dFound << Dispatch( {}, "100", ScaleBox, {Legend Model( 17, Properties( 0, {Line Color( 73 ), Marker Size( 10 )}, Item ID( "F", 1 ) ), Properties( 1, {Line Color( 45 ), Marker Size( 10 )}, Item ID( "M", 1 ) ) )} );

@julian 

7 REPLIES 7
julian
Staff

Re: How do I get the containers of Scatterplot 3D

Hi @Pearl,

Scatterplot 3D uses a Display3DBox, so this should work to reference that object, and what you'll use for most messages (setting wall colors, markers, rotation,spin, etc):

Window( Window name )[Display3DBox(1)]

If you need to set the background color, you'll actually want to reference the SceneBox:

Window( Window name )[SceneBox(1)]<<Background color(blue)

 

Here's a full example where I set both the walls and background blue:

Open( "$SAMPLE_DATA\Big Class.jmp" );

s3d = Scatterplot 3D( Y( :age, :height, :weight ), Frame3D( Set Grab Handles( 0 ) ) );


//view properties if you wish to see options
//show properties(Window( "Big Class - Scatterplot 3D" )[SceneBox(1)])
//show properties(Window( "Big Class - Scatterplot 3D" )[Display3DBox(1)])

Window( "Big Class - Scatterplot 3D" )[Display3DBox( 1 )] << Set Wall Color( 5 );

Window( "Big Class - Scatterplot 3D" )[Scene Box( 1 )] << Background color( blue );

 

I hope this helps!

 

@julian 

Pearl
Occasional Contributor

Re: How do I get the containers of Scatterplot 3D

Hi @julian ,

 

Thank you very much for your answer. Display3DBox is very useful to change many properties.


However, I still cannot change the legend of the plot. If I save the script this is the code, and it appears under SendToReport(Dispatch(...)).

 

obj = Scatterplot 3D(
	Y( :x, :y, :z ),
	Coloring( :T composed 2 ),
	Legend( 84 ),
	Frame3D( Legend( 1 ), Set Grab Handles( 0 ), Set Rotation( -54, 0, 38 ) ),
	SendToReport(
		Dispatch(
			{},
			"100",
			ScaleBox,
			{Legend Model( 3, Properties( 0, {gradient( {Color Theme( "Spectral" )} )} ) )}
		)
	);
);

Would you know a way to access these properties similar to Window( Window name )[Display3DBox(1)]?

0 Kudos
julian
Staff

Re: How do I get the containers of Scatterplot 3D

Hi @Pearl,

To tell the platform to dispatch options, you'll need a handle to the scriptable object (the scatterplot 3d platform itself) rather than the report window. We can use <<Get Scriptable Object to help us out here. Once you have that handle, you can send the exact dispatch message you found when you saved the script. Here's a full example of that, including the previous customizations I showed:

Open( "$SAMPLE_DATA\Big Class.jmp" );

s3d = Scatterplot 3D( Y( :age, :height, :weight ), Coloring( :sex ), Legend( 17 ), Frame3D( Legend( 1 ) ) );

//view properties if you wish to see options
//show properties(Window( "Big Class - Scatterplot 3D" )[SceneBox(1)]);
//show properties(Window( "Big Class - Scatterplot 3D" )[Display3DBox(1)]);

//set colors, contolled in the report layer
Window( "Big Class - Scatterplot 3D" )[Display3DBox( 1 )] << Set Wall Color( 5 ); Window( "Big Class - Scatterplot 3D" )[Scene Box( 1 )] << Background color( blue ); //find the scriptable object so that options can be dispatched s3dFound = Window( "Big Class - Scatterplot 3D" )[Outline Box( 1 )] << Get Scriptable Object; //Dispatch options by sending messages to that scriptable object s3dFound << Dispatch( {}, "100", ScaleBox, {Legend Model( 17, Properties( 0, {Line Color( 73 ), Marker Size( 10 )}, Item ID( "F", 1 ) ), Properties( 1, {Line Color( 45 ), Marker Size( 10 )}, Item ID( "M", 1 ) ) )} );

@julian 

Highlighted
julian
Staff

Re: How do I get the containers of Scatterplot 3D

I should add, if you use a script to generate the output in the first place, you'll already have a handle to the platform (assuming you did so when you launched the platform). In my example, that's s3d. But, if you have a window that is not generated by a script, using <<Get Scriptable Object allows you to establish a handle to that platform.
0 Kudos
Pearl
Occasional Contributor

Re: How do I get the containers of Scatterplot 3D

Thank you @julian, this is very interesting.
0 Kudos

Re: How do I get the containers of Scatterplot 3D

If you change the colors interactively and save the script, Scatterplot 3D will record the colors directly as part of the script:

 

Scatterplot 3D(
	Y( :age, :height, :weight ),
	Frame3D(
		Set Wall Color( -16750758 ),
		Set Grab Handles( 0 ),
		Set Rotation( -52.9429431878029, -1.24217455677765, 22.838483399832 ),
		Background Color( 144, 191, 4 )
	)
);

This might be the easiest solution if you know the colors that you want when the platform is launched.

Pearl
Occasional Contributor

Re: How do I get the containers of Scatterplot 3D

Thank you @danschikore, as you say the easiest solution is to change the default settings in Preferences. However, changing the properties in a script could be useful for me in the future.
0 Kudos