/* Objective
In a 3D surface Plot one can set the settings for Markers in the graph by right click and e.g. Marker Scale, Marker Quality and so forth. This is easy for one graph. If you have a by Group with many groups you have to do this for each graph manually again, no control key works for replication.
So how to replicate setting the option e.g. for Marker Scale and Marker Quality to all others???
*/
/* Ideas
I thought about saving the script and use this script as an expression where I could substitute Frame3D properties so that I have the desired options. Or substitute . "ScaleBox" with "ScaleBox(Set Marker Scale(5), Set Marker Quality(0)), ScaleBox" which is within the output of the Get Script command.
Another idea was to use XPath, but I failed to automate things. I used
r_sp[Box(1)][ListBox(2)][PictureBox(1)][ScaleBox(1)][Display3DBox(1)] << Set Marker Scale (5)
which worked for the first but not all others as I couldn't figure out how to get rid of the indices.
*/
Attached a script where I tested some papproaches. I'd appreciate any solution other than copy past the parts into the ByGroup sections and then run the script again. The example has 3 groups but the use case has about 90 groups.
Thanks,
Martin
/* Objective
In a 3D surface Plot one can set the settings for Markers in the graph by right click and e.g. Marker Scale, Marker Quality and so forth. This is easy for one graph. If you have a by Group with many groups you have to do this for each graph manually again, no control key works for replication.
So how to replicate setting the option e.g. for Marker Scale and Marker Quality to all others???
*/
/* Ideas
I thought about saving the script and use this script as an expression where I could substitute Frame3D properties so that I have the desired options. Or substitute . "ScaleBox" with "ScaleBox(Set Marker Scale(5), Set Marker Quality(0)), ScaleBox" which is within the output of the Get Script command.
Another idea was to use XPath, but I failed to automate things. I used
r_sp[Box(1)][ListBox(2)][PictureBox(1)][ScaleBox(1)][Display3DBox(1)] << Set Marker Scale (5)
which worked for the first but not all others as I couldn't figure out how to get rid of the indices.
*/
Names Default to Here(1);
// Generate table and report (3D Plot) - this usually is done manually
dt = Open("$SAMPLE_DATA/Iris.jmp");
// Surface Plot, Goal is to set Marker Quality for all ByGroups to 0. Currently it is just for the first group.
sp = dt << Surface Plot(
SendToByGroup( {:Species == "setosa"} ),
Columns( :Sepal length, :Sepal width, :Petal length ),
Datapoints Choice( "Points" ),
Response( :Petal length ),
SetVariableAxis( :Sepal length, Axis Data( {} ) ),
SetVariableAxis( :Sepal width, Axis Data( {} ) ),
SendToByGroup( {:Species == "setosa"}, SetZAxis( z#1, Current Value( 1.45 ) ) ),
SendToByGroup(
{:Species == "versicolor"},
SetZAxis( z#1, Current Value( 4.125 ) )
),
SendToByGroup(
{:Species == "virginica"},
SetZAxis( z#1, Current Value( 5.75 ) )
),
SetXVariable( :Sepal length ),
SetYVariable( :Sepal width ),
SendToByGroup(
{:Species == "setosa"},
Frame3D(
Set Rotation( -54, 0, 38 ),
Set Marker Quality( 0 ),
Set Marker Scale( 1.585 )
)
),
SendToByGroup(
{:Species == "versicolor"},
Frame3D( Set Rotation( -54, 0, 38 ) )
),
SendToByGroup(
{:Species == "virginica"},
Frame3D( Set Rotation( -54, 0, 38 ) )
),
By( :Species )
);
// Get report
r_sp = sp << report();
// usually one would need to use:
// r_sp = currentreport();
// idea 1: Build Expression and to be substituted with string
reportExpr = Expr(
Surface Plot(
SendToByGroup( {:Species == "setosa"} ),
Columns( :Sepal length, :Sepal width, :Petal length ),
Datapoints Choice( "Points" ),
Response( :Petal length ),
SetVariableAxis( :Sepal length, Axis Data( {} ) ),
SetVariableAxis( :Sepal width, Axis Data( {} ) ),
SendToByGroup( {:Species == "setosa"}, SetZAxis( z#1, Current Value( 1.45 ) ) ),
SendToByGroup( {:Species == "versicolor"}, SetZAxis( z#1, Current Value( 4.125 ) ) ),
SendToByGroup( {:Species == "virginica"}, SetZAxis( z#1, Current Value( 5.75 ) ) ),
SetXVariable( :Sepal length ),
SetYVariable( :Sepal width ),
SendToByGroup(
{:Species == "setosa"},
Frame3D( _property_ )
),
SendToByGroup( {:Species == "versicolor"}, Frame3D( _property_ ) ),
SendToByGroup( {:Species == "virginica"}, Frame3D( _property_ ) ),
By( :Species )
)
);
ReplaceWith = "Set Rotation( -54, 0, 38 ),Set Marker Quality( 0 ), Set Marker Scale( 5 )" ;
// NameExpr(reportExpr);
tmp = Substitute(
NameExpr( reportExpr),
Expr( _property_ ), ReplaceWith,
);
// This does not work as there are "..." included which throws an error obviously. I checked different approaches but gave up and ask now :)
// eval( tmp );
// idea 3: Get script and change the code, however I failed and in addition was not sure how to change the report with the new script
myExpr = r_sp << Get Script;
// what next?Hi Martin,
I think this will do it.
However, I did notice it works on Windows host but seems to have no effect with Mac host.
Perhaps it has something to do with how Open GL is used on each host.
Adding @Paul_Nelson to see if he can add more insight wrt to host dependency artifact.
Stan
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Iris.jmp");
sp = dt << Surface Plot(
SendToByGroup( {:Species == "setosa"} ),
Columns( :Sepal length, :Sepal width, :Petal length, :Petal width ),
Datapoints Choice( "Points" ),
Surface Color Theme( "Green to Black to Red" ),
Surface Color Theme2( "Green to White to Red" ),
Surface Color Theme3( "White to Black" ),
Surface Color Theme4( "Blue to Gray to Red" ),
Response Column Color Theme( "Blue to Green to Red" ),
Response Column Color Theme2( "Spectral" ),
Response Column Color Theme3( "Jet" ),
Response Column Color Theme4( "White to Blue" ),
Response( :Petal length ),
Surface Color Method( "Solid", "Solid", "Solid", "Solid" ),
SetVariableAxis( :Sepal length, Axis Data( {} ) ),
SetVariableAxis( :Sepal width, Axis Data( {} ) ),
SendToByGroup(
{:Species == "setosa"},
SetZAxis( Petal length, Current Value( 1.45 ), Axis Data( {} ) )
),
SendToByGroup(
{:Species == "versicolor"},
SetZAxis( Petal length, Current Value( 4.125 ), Axis Data( {} ) )
),
SendToByGroup(
{:Species == "virginica"},
SetZAxis( Petal length, Current Value( 5.75 ), Axis Data( {} ) )
),
SetXVariable( :Sepal length ),
SetYVariable( :Sepal width ),
Frame3D(
Set Walls( 1 ),
Set Rotation( -54, 0, 38 ),
Set Text Scale( 2 ),
Set Line Scale( 1 ),
Set Marker Transparency( 1 ),
Set Marker Quality( 0 ),
Set Marker Scale( 1 ),
Set View Perspective( 0.1 ),
Set View Zoom( 1 )
),
By( :Species )
);
After running script and check on settingsAfter running script and check on settings