請問,是否可以選擇使用自訂 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>