将正态分位数图的线条颜色与行图例中的行颜色集相匹配在单向图中,我在行图例中使用颜色主题“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" )
)}
)
)
);