请问,是否可以选择使用自定义 ppt 模板。如果我们有模板,我们可以在一张幻灯片中添加多个图表吗?
我完全理解你的要求。 然而,有时 JMP 中针对交互式使用的可用功能不能很好地转化为脚本世界。 本地数据过滤器就是其中之一。 它确实是一个很棒的交互工具,但是在下面的脚本中,您将看到它在脚本中的使用,只会使脚本变得更加复杂。 交互式功能在过滤器列表中很好地显示了不同的值,但在 JSL 中使用时,过滤器无法提供这些值。
这是使用脚本化本地数据过滤器的脚本
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );
// Get the levels of the Sex column. The Summarize function will
// create a list of the different levels of whatever column is
// specified in the "By" claue
Summarize( dt, GroupBy = By( :Sex ) );
gb = Graph Builder(
invisible,
Size( 517, 437 ),
Show Control Panel( 0 ),
Variables( X( :age ), Y( :height ) ),
Elements( Box Plot( X, Y, Legend( 3 ) ) )
);
For( i = 1, i <= N Items( GroupBy ), i++,
gb << Local Data Filter( Add Filter( columns( :Sex ), Where( :sex == GroupBy[i] ) ), Mode( Show( 1 ), Include( 1 ) ) );
If( i == 1,
gb << Save Presentation( "$TEMP/jmp_example2.pptx" ),
gb << Save Presentation( "$TEMP/jmp_example2.pptx", Append )
);
gb << remove data filter;
);
Open( "$TEMP/jmp_example2.pptx" );
这是我在回答您的问题时使用的示例,它不使用本地数据过滤器,并且实际上获得了您想要的输出的更好版本。
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );
// Get the levels of the Sex column. The Summarize function will
// create a list of the different levels of whatever column is
// specified in the "By" claue
Summarize( dt, GroupBy = By( :Sex ) );
For( i = 1, i <= N Items( GroupBy ), i++,
gb = dt << Graph Builder(
// The invisible option helps to keep the desktop clean
invisible,
Size( 517, 437 ),
Show Control Panel( 0 ),
Variables( X( :age ), Y( :height ) ),
Elements( Box Plot( X, Y, Legend( 3 ) ) ),
// Here is an easy way to subset the data used in the grap
Where( :sex == GroupBy[i] )
);
If(i==1,
gb << Save Presentation( "$TEMP/jmp_example.pptx" ),
gb << Save Presentation( "$TEMP/jmp_example.pptx", Append );
);
);
Open( "$TEMP/jmp_example.pptx" );
第二个示例的代码要简单得多
为了防止图表在代码运行但尚未写入 ppt 时显示,可以在平台中指定“不可见”选项。 我还添加了一种处理过滤的方法,以便您可以看到一种简单的方法来处理该问题
我还将指出,所有这些选项等均通过示例进行记录和说明:
帮助==>脚本索引
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );
gb = dt << Graph Builder(
// The invisible option helps to keep the desktop clean
invisible,
Size( 517, 437 ),
Show Control Panel( 0 ),
Variables( X( :age ), Y( :height ) ),
Elements( Box Plot( X, Y, Legend( 3 ) ) ),
// Here is an easy way to subset the data used in the grap
Where( :sex == "F" )
);
New Window( "the graph", myvlb = V List Box() );
myvlb << append( Report( gb ) );
这是一个示例脚本。
Names Default to Here( 1 );
// The open function below, just need to point to the .xls or .xlsx file you want to open
dt=open("$SAMPLE_DATA\Big Class.jmp");
// Run the Distribution Platform
dis=dt<<DISTRIBUTION></DISTRIBUTION>