cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
sam_t
Level III

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 );

 

1 ACCEPTED SOLUTION

Accepted Solutions
ih
Super User (Alumni) ih
Super User (Alumni)

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:

  1. 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
  2. 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 );

View solution in original post

3 REPLIES 3
ih
Super User (Alumni) ih
Super User (Alumni)

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:

  1. 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
  2. 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 );
txnelson
Super User

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 );
Jim
ih
Super User (Alumni) ih
Super User (Alumni)

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.