將常態分位數圖的線條顏色與行圖例中的行顏色集相匹配在單向圖中,我在行圖例中使用顏色主題「SAS 統計」為標記著色,但連接常態分位數圖中標記的線條仍使用「JMP 預設」顏色:

我可以透過前往“圖例設定”並將顏色主題變更為“SAS 統計”,手動將線條顏色變更為“SAS 統計”。然而,這種方法實際上對 JSL 中的顏色進行了硬編碼,如下所示,我不能將其用作通用解決方案。例如,在具有四個組(1C、2E、3E 和 4E)的不同資料集中,未定義 4E 的線顏色。是否有使用 JSL 的通用方法來保持線條顏色與我在行圖例中設定的行顏色一致,無論我有多少組?謝謝。

Oneway(
Y( :Data ),
X( :Group ),
Plot Actual by Quantile( 1 ),
Line of Fit( 0 ),
Box Plots( 1 ),
X Axis Proportional( 0 ),
Points Jittered( 1 ),
Grand Mean( 0 ),
SendToReport(
Dispatch(
{},
"222",
ScaleBox,
<FONT color="#FF0000">{Legend Model(
1,
Properties(
0,
{Line Color( -7306931 ), Fill Color( -7306931 )},
Item ID( "1C", 1 )
),
Properties(
1,
{Line Color( -13654875 ), Fill Color( -13654875 )},
Item ID( "2E", 1 )
),
Properties(
2,
{Line Color( -6727072 ), Fill Color( -6727072 )},
Item ID( "3E", 1 )
)
)}</FONT>
),
Dispatch(
{},
"Oneway Plot",
FrameBox,
{DispatchSeg( Box Plot Seg( 1 ), Line Color( "Red" ) ),
DispatchSeg( Box Plot Seg( 2 ), Line Color( "Red" ) ),
DispatchSeg( Box Plot Seg( 3 ), Line Color( "Red" ) ),
Row Legend(
Group,
Color( 1 ),
Color Theme( "SAS Statistical" ),
Marker( 0 ),
Marker Theme( "" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
)
)
);回覆:將常態分位數圖的線條顏色與行圖例中的行顏色集相匹配忘記發布更新的 JSL 功能:
SetNQPLineColor = function({ow,theme},
{Default Local},<BR />
// Get the colors defined by the Color Theme
c = Get Color Theme Detail( eval(theme) );
// Get the # of line segs
ow_frmbx = ow << xpath("//FrameBox[@helpKey=\!"Oneway QuantilePlot\!"]");
Nseg = ow_frmbx << segCount("Line Seg");
Nseg=Nseg[1];
// Loop across the segments setting the lines to the required colors
For( i = 1, i <= min( Nseg , 2 * N Items(Eval List(c[3])) ), i+= 2,
seg = ow_frmbx << Find Seg( Line Seg( i ) );
seg << Line Color( c[3][Ceiling( i / 2 )] );
);
"Done";
);回覆:將常態分位數圖的線條顏色與行圖例中的行顏色集相匹配@tx尼爾森謝謝你的建議。我想我可能已經解決了這個問題。如果我只設定前12組的顏色,其餘的保持原樣,JMP似乎有一種演算法可以根據這12組生成它們的顏色,並且生成的顏色與「按列顏色」中的行顏色相匹配:

回覆:將常態分位數圖的線條顏色與行圖例中的行顏色集相匹配副手我不知道。我會查看文檔,和/或運行一些測試,並找出它的作用。另一個選擇是讓您接管設定顏色的所有控制權,並讓您想出自己的顏色。
回覆:將常態分位數圖的線條顏色與行圖例中的行顏色集相匹配@tx尼爾森後續問題:如果組數超過 12 個,則會出現以下錯誤,並且第 13 行變為白色:
Ceiling(i / 2) = 13;
Subscript Range in access or evaluation of 'c[3][Ceiling(i / 2)]' , c[3][/*###*/Ceiling( i / 2 )]

似乎「SAS Statistical」只定義了 12 種顏色:
N Items(Eval List(Get Color Theme Detail("SAS Statistical")[3])) = 12;那麼,如果組數多於顏色主題中定義的顏色數量,JMP 如何處理?例如,在上圖中,第 13 組的標記顏色與其他 12 組不同。JMP 如何決定此顏色?謝謝。
回覆:將常態分位數圖的線條顏色與行圖例中的行顏色集相匹配稍微修改了腳本,這樣我就不必返回 dt 來查找組數,並將其變成一個函數以便於使用。
SetNQPLineColor = function({ow,theme},
{Default Local},
// Get the colors defined by the Color Theme
c = Get Color Theme Detail( eval(theme) );
// Get the # of line segs
ow_frmbx = ow << xpath("//FrameBox[@helpKey=\!"Oneway QuantilePlot\!"]");
Nseg = ow_frmbx << segCount("Line Seg");
Nseg=Nseg[1];
// Loop across the segments setting the lines to the required colors
For( i = 1, i <= Nseg, i+= 2,
seg = ow_frmbx << Find Seg( Line Seg( i ) );
seg << Line Color( c[3][Ceiling( i / 2 )] );
);
"Done!";
);
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );
// Set the row state colors
dt << color by column( :age , color theme("SAS Statistical"));
// Create the chart
ow1 = Oneway(
Y( :height ),
X( :age ),
Plot Actual by Quantile( 1 ),
Box Plots( 1 )
);
SetNQPLineColor(ow1,"SAS Statistical");
回覆:將常態分位數圖的線條顏色與行圖例中的行顏色集相匹配@tx尼爾森謝謝你!這效果很好。
回覆:將常態分位數圖的線條顏色與行圖例中的行顏色集相匹配我想我終於弄清楚了你所說的實際問題......請原諒我的頭腦笨重......
這是一種使用顏色主題將點顏色與線條顏色相匹配的方法...在本例中為 SAS 統計顏色主題

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );
// Set the row state colors
dt << color by column( :age , color theme("SAS Statistical"));
// Find out how many groupings there are
summarize( dt, grpBy = By( :age ) );
// Create the chart
ow = Oneway(
Y( :height ),
X( :age ),
Plot Actual by Quantile( 1 ),
Box Plots( 1 )
);
// Get the colors defined by the Color Theme
c = Get Color Theme Detail( "SAS Statistical" );
// Loop across the segments setting the lines to the required colors
For( i = 1, i <= N Items( grpBy ) * 2, i = i + 2,
seg = (Report( ow )[FrameBox( 2 )] << Find Seg( Line Seg( i ) ));
seg << line color( c[3][Ceiling( i / 2 )] );
);回覆:將常態分位數圖的線條顏色與行圖例中的行顏色集相匹配@tx尼爾森感謝你的回覆。但是,它不適用於“JMP 預設”以外的顏色主題。
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );
dt << color by column( :sex , <FONT color="#ff0000"><STRONG>color theme("SAS Statistical")</STRONG></FONT>);
Oneway(
Y( :height ),
X( :sex ),
Plot Actual by Quantile( 1 ),
Box Plots( 1 ),
SendToReport(
Dispatch(
{},
"Oneway Plot",
FrameBox,
{DispatchSeg( Box Plot Seg( 1 ), Line Color( "Red" ) ), DispatchSeg(
Box Plot Seg( 2 ),
Line Color( "Red" )
)}
)
)
);
回覆:將常態分位數圖的線條顏色與行圖例中的行顏色集相匹配我相信您只需設定行的行狀態顏色,然後執行 Oneway 即可獲得您想要的結果。

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );
dt << color by column( :sex );
Oneway(
Y( :height ),
X( :sex ),
Plot Actual by Quantile( 1 ),
Box Plots( 1 ),
SendToReport(
Dispatch(
{},
"Oneway Plot",
FrameBox,
{DispatchSeg( Box Plot Seg( 1 ), Line Color( "Red" ) ), DispatchSeg(
Box Plot Seg( 2 ),
Line Color( "Red" )
)}
)
)
);