- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Save Bivariate plot to JPEG
Hi, I was able to get the Bivariate plot. But I'm unable to save the plot as a picture as I have error in my save.
Any help would be great. Thanks.
Open("C:\jmp_data\NamesData.jmp", window bounds(600, 50, 500, 400), window state(maximized));
window_DATA = New Window("NAMES SHOW", Bivariate(Y(:Name("AGES")), X(:Name("GENDER")), Fit Line({Line Color({100, 50, 50})}))) << Maximize Display << Set Window Icon("FitYByX");
window_DATA << save picture( "C:\jmp_data\NamesAge.JPG", JPEG );
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Save Bivariate plot to JPEG
I assume the error you get relates to needing a scriptable object. Right now you send a message to the window and save the result of the sent message to window_DATA. You instead want to save a reference to the window itself and then send a message to it. Two options are to:
- Do it all in one 'line', similar to your code now, but use order of operations to make sure the variable is defined before sending a message to the window, or
- Do this in two lines.
I recommend the latter as it is more readable.
Names default to here( 1 );
dt = Open("$Sample_data/iris.jmp");
//All at once
( window_DATA_1 = New Window( "NAMES SHOW",
Bivariate(
Y( :Name( "Sepal length" ) ),
X( :Name( "Petal length" ) ),
Fit Line( {Line Color( {100, 50, 50} )} )
)
) ) << Maximize Display << Set Window Icon( "FitYByX" );
window_DATA_1 << save picture( "$Desktop\Picture_1.JPG", JPEG );
//In two steps
window_DATA_2 = New Window( "NAMES SHOW",
Bivariate(
Y( :Name( "Sepal length" ) ),
X( :Name( "Petal length" ) ),
Fit Line( {Line Color( {100, 50, 50} )} )
)
);
window_DATA_2 << Maximize Display << Set Window Icon( "FitYByX" );
window_DATA_2 << save picture( "$Desktop\Picture_2.JPG", JPEG );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Save Bivariate plot to JPEG
I assume the error you get relates to needing a scriptable object. Right now you send a message to the window and save the result of the sent message to window_DATA. You instead want to save a reference to the window itself and then send a message to it. Two options are to:
- Do it all in one 'line', similar to your code now, but use order of operations to make sure the variable is defined before sending a message to the window, or
- Do this in two lines.
I recommend the latter as it is more readable.
Names default to here( 1 );
dt = Open("$Sample_data/iris.jmp");
//All at once
( window_DATA_1 = New Window( "NAMES SHOW",
Bivariate(
Y( :Name( "Sepal length" ) ),
X( :Name( "Petal length" ) ),
Fit Line( {Line Color( {100, 50, 50} )} )
)
) ) << Maximize Display << Set Window Icon( "FitYByX" );
window_DATA_1 << save picture( "$Desktop\Picture_1.JPG", JPEG );
//In two steps
window_DATA_2 = New Window( "NAMES SHOW",
Bivariate(
Y( :Name( "Sepal length" ) ),
X( :Name( "Petal length" ) ),
Fit Line( {Line Color( {100, 50, 50} )} )
)
);
window_DATA_2 << Maximize Display << Set Window Icon( "FitYByX" );
window_DATA_2 << save picture( "$Desktop\Picture_2.JPG", JPEG );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Save Bivariate plot to JPEG
The Window Object does not have a Save Picture message available to it. See the Scripting Index for the messages that can be passed to the Window Object. What you need to do is to save an object within the window that has the Save Picture message supported. Here is one possible solution
Names Default to Here( 1 );
Open(
"C:\jmp_data\NamesData.jmp",
window bounds( 600, 50, 500, 400 ),
window state( maximized )
);
window_DATA = New Window( "NAMES SHOW",
Biv = Bivariate(
Y( :Name( "AGES" ) ),
X( :Name( "GENDER" ) ),
Fit Line( {Line Color( {100, 50, 50} )} )
)
) << Maximize Display << Set Window Icon( "FitYByX" );
report( Biv ) << save picture( "C:\jmp_data\NamesAge.JPG", JPEG );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Save Bivariate plot to JPEG
Apparently, at least in 13.2.1, the Save Picture message works but is not documented. At least for me, just adding parentheses to the original code works.