This discussion question seems to be related to, or the same question as the previous discussion Select rotation and data columns from 3D scatterplot plot script
To answer the specific question from this post, Your script
sp = Scatterplot 3D(
Y( :age, :height, :weight ),
Frame3D( Set Grab Handles( 0 ), Set Rotation( -54, 0, 38 ) )
);
when run, generates a output display object which can be accessed in JSL by creating a variable to point to the object
spr = report( sp );
//or
spr = sp << report;
"spr" does not contain the scatter plot, but rather is a pointer to the top object within the Output Display Tree that contains the scatter plot and the various objects associated with the output display.
Below is the script I wrote for the above referenced Discussion Question. In it, it allows the user to run a Scatter Plot 3D, and when the scatter plot is closed, it goes into the display tree and extracts the JMP script that if run, would regenerate the Scatter Plot 3D, just as it was when it was closed. The script then goes on and extracts out the columns for the 3 axes and the rotation values, into 2 JMP lists called varsList and rotationList, respectively. From there, it adds those values back to the original JMP data table as new columns, and then saves the data table as a csv file.
Not knowing what the format of what you need in your csv file to pass to R, this was just a guess of what is needed.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );
sp = Scatterplot 3D(
Y( :age, :height, :weight ),
Frame3D( Set Grab Handles( 0 ), Set Rotation( -54, 0, 38 ) )
);
sp << on close(
theScript = Char( (Report( sp ) << get scriptable object) << get script );
varsList = {};
Insert Into( varsList, Word( 2, Substr( theScript, Contains( theScript, "Y(" ) ), ":," ) );
Insert Into( varsList, Word( 4, Substr( theScript, Contains( theScript, "Y(" ) ), ":," ) );
Insert Into( varsList, Word( 6, Substr( theScript, Contains( theScript, "Y(" ) ), ":,)" ) );
rotationList = {};
Insert Into( rotationList, Word( 2, Substr( theScript, Contains( theScript, "Rotation(" ) ), "()," ) );
Insert Into( rotationList, Word( 3, Substr( theScript, Contains( theScript, "Rotation(" ) ), "()," ) );
Insert Into( rotationList, Word( 4, Substr( theScript, Contains( theScript, "Rotation(" ) ), "()," ) );
dtSub = dt << subset( columns( Eval( varsList ) ), selected rows( 0 ) );
dtSub << New Column( "_Vars_", character, set values( varsList ) );
dtSub << New Column( "_Rotation_", character, set values( rotationList ) );
dtSub << Save( "$TEMP/passvalues.csv" );
close( dtSub, nosave );
);
// This line opens the csv back into JMP
//open("$TEMP/passvalues.csv");
As a note of how JMP works, one cannot place the scatter plot into a variable, and then pass it to R or save it as a .csv file. However, one can extract the image of the scatter plot at save the image to an image file, or pass the image as a blob. I don't exactly know what you are looking for. You may want to look into JMP automation, which would allow you to call R from JMP and for you to pass the information you need directly from JMP to R.
Please get back to the community with more specifics of exactly what you need and we will make an attempt to help you solve the issues.
Finally, I strongly encourage you to take the time to read the Scripting Guide for JMP/JSL that can be found in the JMP Documentation Library under the Help pull down menu.
Jim