분포(히스토그램) 플롯에서 수평 축의 레이블 방향과 형식(엔지니어링 SI)을 변경하려고 합니다. 내가 만들고 있는 표현식 내에서 디스패치 문을 사용하여 첫 번째 항목에 대해 수행할 수 있지만 열 목록의 모든 히스토그램에 대해 수행할 수 있어야 합니다.
다음에서 "{}" 사이에 열 이름에 대한 다양한 유형의 호출을 삽입하려고 했습니다.
보내다( {},
그러나 아무도 히스토그램을 변경하지 않습니다. 문자 그대로 열 이름(예: {"My Column"})만 넣으면 작동하지만 colList 배열의 모든 이름에 대해 수행하고 싶습니다.
dt = currentdatatable();
col = dt << get column names();
nc = N Items( col );
colList = {};
bin_width={};
For( i = 1, i <= nc, i++,
If(Contains (col[i],"::"),
Insert Into( colList, col[i] ))
);
For(i = 1, i <= N Items(colList), i++,
Insert Into(bin_width,0.0);
bin_width[i] = Col Max(Column(dt, colList[i])) - Col Min(Column(dt, colList[i]));
bin_width[i] = bin_width[i]/10;
);
theExpr = "dis = dt << Distribution(Stack( 1 ),
Continuous Distribution( column( column(dt,colList[1])), Set Bin Width(bin_width[1]), Label Row( Label Orientation( \!"Perpendicular\!" ) ))
";
For( i = 2, i < N Items( colList ), i++,
theExpr = theExpr || ", Continuous Distribution( column( column(dt, colList[" || Char( i ) || "])), Set Bin Width(bin_width[i]))"
);
theExpr = theExpr || ",
SendToReport(
Dispatch(
{},
\!"1\!",
ScaleBox,
{Format( \!"Engineering SI\!", 10 ), Minor Ticks( 0 ),
Label Row( Label Orientation( \!"Perpendicular\!" ) )}
)
);";
Eval( Parse( theExpr ) );내가 취할 접근 방식은 다음과 같습니다.
dt = currentdatatable();
col = dt << get column names();
nc = N Items( col );
colList = {};
bin_width={};
For( i = 1, i <= nc, i++,
If(Contains (col[i],"::"),
Insert Into( colList, col[i] ))
);
For(i = 1, i <= N Items(colList), i++,
Insert Into(bin_width,0.0);
bin_width[i] = Col Max(Column(dt, colList[i])) - Col Min(Column(dt, colList[i]));
bin_width[i] = bin_width[i]/10;
);
theExpr = "dis = dt << Distribution(Stack( 1 ),
Continuous Distribution( column( column(dt,colList[1])), Set Bin Width(bin_width[1]), Label Row( Label Orientation( \!"Perpendicular\!" ) ))
";
For( i = 1, i < N Items( colList ), i++,
theExpr = theExpr || ", Continuous Distribution( column( column(dt, colList[" || Char( i ) || "])), Set Bin Width(bin_width[i]))"
);
Eval( Parse( theExpr ) );
(dis << xpath("//AxisBox")) << format("Engineering SI", 10);
(dis << xpath("//AxisBox")) << Minor Ticks( 0 );
(dis << xpath("//AxisBox")) << Label Row( Label Orientation( "Perpendicular" ));