테마 형식에 표현식 사용여러 유사한 플롯의 형식을 표현식으로 만들어 코드의 단일 섹션을 변경하여 유사해 보이는 모든 플롯을 업데이트하려고 합니다. 그러나 코드로 구현하는 데 어려움을 겪습니다. 플롯의 모양과 코드의 모양을 보여주는 최소한의 작업 예제를 포함하고 있으며 서식 지정을 위한 코드 조각과 각 플롯에 대한 압축 코드를 저장합니다. 이것이 작동하도록 수정하는 방법에 대한 아이디어가 있습니까? 저는 JMP 버전 15.2를 사용하고 있습니다.
dt = New Table( "Minimal Working Example",
Add Rows( 400 ),
New Column( "X", Numeric, Set Values( Repeat( 1 :: 20, 20 ) ) ),
New Column( "Y", Numeric, Set Values( Sort Ascending( Shape( Repeat( 1 :: 20, 20 ), 1 ) ) ) ),
New Column( "Size", Numeric, <<FORMULA></FORMULA>
<LINGO-LABS id="lingo-labs-398923" slang="en-US" mode="UPDATE"><LINGO-LABEL>고급 통계 모델링</LINGO-LABEL><LINGO-LABEL>데이터 접근</LINGO-LABEL><LINGO-LABEL>데이터 혼합 및 정리</LINGO-LABEL><LINGO-LABEL>대량 맞춤화</LINGO-LABEL></LINGO-LABS>Re : 테마 형식에 대한 표현 사용안녕하세요,
표현식 처리는 강력하며 약간의 연습이 필요합니다. 여기에 시작하기위한 예제가 있지만 Eval (), Expr (), NameExpr (), Substitute (), Substitute Into () 등과 같은 것에 대해 읽어보고 싶을 것입니다.
Names Default To Here(1);
//make a 5-column table
dt = astable((1::20)` || J(20,4,randominteger(0,20)));
//the x column will be the first column
xCol = column (dt, 1);
//the y columns will be the remaining columns
yColList = (dt << get column names())[2::ncol(dt)];
//write the graph builder script, wrapping it in an expression. Use _XXX_ format for things
//you'll be substituting later. Here, that is just the "y" variable for a particular graph.
gbExpr = expr(
dt << Graph Builder(
Variables( X( xcol ), Y( _Y_ ) ),
Elements( Points( X, Y, Legend( 8 ) ) ),
SendToReport(
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
8,
Properties(
0,
{gradient( {Color Theme( "White to Red" )} )},
Item ID( "Size", 1 )
)
)}
),
Dispatch(
{},
"400",
LegendBox,
{Legend Position( {8, [0, -1]} ), Legend Position( {0, -1} )}
)
)
);
);
//cycling through the items in yColList, we create a graph for each y variable vs the x variable.
//be sure to read up on Name Expr ( ), as it is needed here to prevent evaluation of the Graph
//Builder script... we just want the code itself... we don't want JMP to try to evaluate the code
//until after we've made the substitution.
for (i = 1,i <=nitems(ycolList), i++,
eval(Substitute( nameExpr(gbExpr), expr(_Y_) , expr(yColList[i])));
);
건배,
브래디
Re: 테마 형식에 표현식 사용하기내 데이터에서 X, Y 및 Color 변수가 변경되는 방식 때문에 잘 작동하지 않았지만 JSL Quote, Eval Insert, Parse 및 Eval을 사용하여 원하는 것에 더 가까운 솔루션을 찾을 수 있었습니다.
// A theme format I could change for a gazillion of plots
formats = JSL Quote(
SendToReport(
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
8,
Properties(
0,
{gradient( {Color Theme( "White to Red" )} )},
Item ID( "Size", 1 )
)
)}
),
Dispatch(
{},
"400",
LegendBox,
{Legend Position( {8, [0, -1]} ), Position( {0, -1} )}
)
)
);
// How I would like each plot code to look like
Eval(Parse(Eval Insert("dt << Graph Builder(
Variables( X( :X ), Y( :Y ), Color( :Size ) ),
Elements( Points( X, Y, Legend( 8 ) ) ),
^formats^
);")));