Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
markschwab
Level III

JSL "getpicture" command is cropping graph?

I'm trying to write a script that saves graphs as images, however the saved image is always a truncated version of the graph instead of the entire graph. Here's example images and the script that generated them (notice the X axis is cut off, as is the legend on the far right:)

 

test_height.png

test_weight.png

 

dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
Ycols = {"height", "weight"};
For( iMetric = 1, iMetric<= 2, iMetric+=1,
	metric = Ycols[iMetric];
	thisgraph = dt << Graph Builder(
		Automatic Recalc(0),
		Variables( X (:age), Y (Eval(metric)));
	);
	image = Report( thisgraph) << getpicture;
	image << saveimage ("test_" || metric || ".png")
);

How can I save the whole graph without it getting truncated?

 

5 REPLIES 5
Highlighted
txnelson
Super User

Re: JSL "getpicture" command is cropping graph?

I could not replicate the issue in JMP 15, on Windows 10.  What version are you using?

You may want to try just copying the Picture Box(), not the whole report

image = Report( thisgraph)[PictureBox(1)] << getpicture;

  

Jim
Highlighted
markschwab
Level III

Re: JSL "getpicture" command is cropping graph?

I'm using JMP Pro 14.3.0. When I change the command to "image = Report( thisgraph)[PictureBox(1)] << getpicture;" the images still look identical to those I pasted above.

Highlighted
txnelson
Super User

Re: JSL "getpicture" command is cropping graph?

I reran your original script on JMP 14.2 and I still was not able to replicate your issue. I suggest you contact JMP Support
support@jmp.com
Jim
Highlighted
markschwab
Level III

Re: JSL "getpicture" command is cropping graph?

Update: when I undock my laptop from my docking station and re-run the script, the images look good. But when I dock the laptop back into the docking station and run the script, the images are truncated.

 

Maybe it's some kind of bug with having different screen resolutions on different monitors?

Highlighted
txnelson
Super User

Re: JSL "getpicture" command is cropping graph?

Hopefully the issue has been fixed in JMP 15
Jim
Article Labels