您好,我对 JMP 很陌生,有一个问题:是否可以保存动画?
例如,如果我在某个表上按 X 拟合 Y,然后使用数据过滤器动画。 可以保存动画/剪辑吗?
谢谢!
您可以在此处找到使用数据过滤器保存动画 GIF 的另一个示例:将数据过滤器动画另存为动画 GIF 。
如果您在 Windows 上使用 JMP 13,则可以使用新的 JSL 功能创建动画 GIF 来保存数据过滤器动画。
下面的示例将使用本地数据过滤器创建图形生成器,并保存和打开动画 GIF。 欲了解更多信息,请查看@约翰·庞特的关于使用气泡图制作动画 GIF 的帖子。 我在下面的脚本中借用了他的飓风示例中的大量代码。 理论上,如果您运行以“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");
编辑添加生成的 GIF 文件:
Resulting animated gif生成的 gif 动画