cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
aumair
Level III

Saving JMP animation

Hello, I am quite new to JMP and have a question: Is it possible to save animation?

For example, if I do Fit Y by X on some table and  then use data filter animation. Would it be possible to save the animation/clip?

Thanks!

  

2 ACCEPTED SOLUTIONS

Accepted Solutions

Re: Saving JMP animation

If you are using JMP 13 on Windows, you can use the new JSL functionality for creating animated GIFs to save your Data Filter animation.

Below is an example that will create a Graph Builder with a Local Data Filter and an animated GIF will be saved and opened. For more info, check out @JohnPonte's post about animated GIFs using Bubble Plot. I borrowed a lot of code from his hurricanes example in the script below. Theoretically, this can work on a current window that you have open if you run everything starting with the line "report = Current Report()."

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
gb = dt << Graph Builder(
	Show Control Panel( 0 ),
	Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
	Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) ),
	Local Data Filter(
		Add Filter(
			columns( :age ),
			Where( :age == 12 ),
			Display( :age, Size( 202, 114 ), List Display )
		)
	)
);

report = Current Report();

ldf_listBox = report[ListBoxBox(1)];

numLevels = NItems(ldf_ListBox << Get ITems);

// Create a new image, same size as the graph we are going to capture
graphFrame = report[FrameBox(1)] << getPicture();
{w, h} = graphFrame << getSize();
img = newImage(w, h);

for(i=1,i<=numLevels,i++,
	
	// deselect old selection
	selectedItems = ldf_listBox << Get Selected Indices;
	for(k=1,k<=nitems(selectedItems),k++,
		ldf_listBox << set selected(selectedItems[k],0);
	);
	
	// set the next item selected
	ldf_listBox << set selected(i);
	
	wait(0); // wait for the display to update
	// Capture frame for current graph and save to animated image
	graphFrame = report[FrameBox(1)] << getPicture();
	{r, g, b} = graphFrame << getPixels("rgb");
	img << addFrame();
	img << setFrameDuration(1000);  // Time between frames, in ms
	img << setPixels("rgb", {r, g, b});	
	wait(0.5); // for demonstration purposes
);

// Remove inital blank frame
img << removeFrame(0);

// Write out animated image
img << saveImage ("$temp\animated.gif", gif);

// open the gif
open("$temp\animated.gif");

Edited to add the resulting GIF file:Resulting animated gifResulting animated gif

 

 

Justin

View solution in original post

JohnPonte
Staff (Retired)

Re: Saving JMP animation

You can find another example of saving an animated GIF with a Data Filter here: Save a Data Filter animation as an animated GIF.

 

 

View solution in original post

3 REPLIES 3

Re: Saving JMP animation

If you are using JMP 13 on Windows, you can use the new JSL functionality for creating animated GIFs to save your Data Filter animation.

Below is an example that will create a Graph Builder with a Local Data Filter and an animated GIF will be saved and opened. For more info, check out @JohnPonte's post about animated GIFs using Bubble Plot. I borrowed a lot of code from his hurricanes example in the script below. Theoretically, this can work on a current window that you have open if you run everything starting with the line "report = Current Report()."

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
gb = dt << Graph Builder(
	Show Control Panel( 0 ),
	Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
	Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) ),
	Local Data Filter(
		Add Filter(
			columns( :age ),
			Where( :age == 12 ),
			Display( :age, Size( 202, 114 ), List Display )
		)
	)
);

report = Current Report();

ldf_listBox = report[ListBoxBox(1)];

numLevels = NItems(ldf_ListBox << Get ITems);

// Create a new image, same size as the graph we are going to capture
graphFrame = report[FrameBox(1)] << getPicture();
{w, h} = graphFrame << getSize();
img = newImage(w, h);

for(i=1,i<=numLevels,i++,
	
	// deselect old selection
	selectedItems = ldf_listBox << Get Selected Indices;
	for(k=1,k<=nitems(selectedItems),k++,
		ldf_listBox << set selected(selectedItems[k],0);
	);
	
	// set the next item selected
	ldf_listBox << set selected(i);
	
	wait(0); // wait for the display to update
	// Capture frame for current graph and save to animated image
	graphFrame = report[FrameBox(1)] << getPicture();
	{r, g, b} = graphFrame << getPixels("rgb");
	img << addFrame();
	img << setFrameDuration(1000);  // Time between frames, in ms
	img << setPixels("rgb", {r, g, b});	
	wait(0.5); // for demonstration purposes
);

// Remove inital blank frame
img << removeFrame(0);

// Write out animated image
img << saveImage ("$temp\animated.gif", gif);

// open the gif
open("$temp\animated.gif");

Edited to add the resulting GIF file:Resulting animated gifResulting animated gif

 

 

Justin
JohnPonte
Staff (Retired)

Re: Saving JMP animation

You can find another example of saving an animated GIF with a Data Filter here: Save a Data Filter animation as an animated GIF.

 

 

aumair
Level III

Re: Saving JMP animation

Thanks a lot!:)