双变量拟合的颜色嗨,我绘制了一个双变量拟合并为每个“运行”拟合一条线性线。 行图例上的颜色与线性拟合线的颜色相匹配(见图 1)
当我应用本地数据过滤器并更改“日期”并因此“运行”可能会更改时,行图例上的颜色现在与线性拟合线的颜色匹配。 参见图 2,Run 14 是红点,但线性拟合线是绿色。
有什么方法可以使行图例和线性拟合线始终相同? 我附上了数据表和脚本。
图片 1:行图例中的颜色与线性拟合线中的颜色匹配。

图片 2:行图例中的颜色与线性拟合线中的颜色不匹配。

脚本回复:双变量拟合的颜色为 Run 列设置 Column Property,Value Colors,当本地过滤器发生变化时,它将始终使用为 Run 列的每个 llevel 设置的 Value Colors。
回复:双变量拟合的颜色我认为我仍然做错了什么。 这是我正在使用的代码。 数据表附在这个步骤的第一个帖子上。 当我按日期移动本地数据过滤器时,其中一个运行消失并且颜色发生变化。 我究竟做错了什么?
dt = Current Data Table();
Show( :Run << get property( "Value Colors" ) );
:Run << set property( "Value Colors", {} );
:Run << color cell by value( 1 );
Show( :Run << get property( "Value Colors" ) );
Bivariate(
Y( :Result ),
X( :Date ),
Fit Where( :Run == "10", Fit Line( {Line Color( {} )} ) ),
Fit Where( :Run == "14", Fit Line( {Line Color( {} )} ) ),
Fit Where( :Run == "24", Fit Line( {Line Color( {} )} ) ),
Fit Where( :Run == "32", Fit Line( {Line Color( {} )} ) ),
Local Data Filter(
Add Filter(
columns( :Date ),
Where( :Date >= 12Mar2022:05:43:20 & :Date <= 06May2022 )
)
),
SendToReport(
Dispatch(
{},
"Bivar Plot",
FrameBox,
{Row Legend(
Run,
Color( 1 ),
Color Theme( "" ),
Marker( 0 ),
Marker Theme( "" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
)
)
);回复:双变量拟合的颜色当您在 Fit Where 上指定线条颜色时,您正在删除对值颜色的选择。下面是一个颜色保持不变的例子


Names Default To Here( 1 );
dt = Current Data Table();
Show( :Run << get property( "Value Colors" ) );
:Run << set property( "Value Colors", {"10" = 35, "14" = 68, "24" = 77, "32" = 75} );
:Run << color cell by value( 1 );
Show( :Run << get property( "Value Colors" ) );
Bivariate(
Y( :Result ),
X( :Date ),
Fit Where( :Run == "10", Fit Line() ),
Fit Where( :Run == "14", Fit Line() ),
Fit Where( :Run == "24", Fit Line() ),
Fit Where( :Run == "32", Fit Line() ),
Local Data Filter(
Add Filter(
columns( :Date ),
Where( :Date >= 12Mar2022:05:43:20 & :Date <= 06May2022 )
)
),
SendToReport(
Dispatch(
{},
"Bivar Plot",
FrameBox,
{Row Legend(
Run,
Color( 1 ),
Color Theme( "" ),
Marker( 0 ),
Marker Theme( "" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
)
)
);回复:双变量拟合的颜色像魅力一样工作,谢谢!