等值线图平台中的反转颜色我有一个脚本,它迭代多个列并生成等值线图。
如果列值为负,我想反转轮廓颜色,所以我设置一个如下变量:
if(col mean( col1 ) < 0, revcols = 1, revcols = 0);
Contour Plot(
...
Reverse Colors( revcols ),
...
然而,我遇到的问题是等值线图现在总是相反的 - 它似乎忽略了 revcols 的值。
如果我硬编码
Reverse Colors( 0 )
那么它不会反转颜色,但如果 revcols = 0 那么它就会反转。
在这种情况下,我是否需要采取一些巧妙的措施才能将值为 0 的变量视为零?
谢谢!
回复:等值线图平台中的反转颜色这是适用于我的系统的解决方法
Clear Globals();
rev = 1;
Eval(
Substitute(
Expr(
Contour Plot(
X( :height, :weight ),
Y( :age ),
Show Data Points( 0 ),
Fill Areas( 1 ),
Label Contours( 0 ),
__reverse__,
Transform( "Range Normalized" ),
Specify Contours( Min( 12.5 ), Max( 16.5 ), N( 9 ) ),
SendToReport(
Dispatch(
{},
"Contour Plot for age",
OutlineBox,
{Set Title( "Contour Plot for age, with rev = " || Char( rev) || " using substitute" )}
)
)
)
),
Expr( __reverse__ ), If(rev==1,parse("Reverse Colors( 1 )"),parse("")))
);回复:等值线图平台中的反转颜色感谢您的建议,但仍然没有运气。 我试过这个:
// Code as run
Clear Globals();
rev = 0;
Eval(
Substitute(
Expr(
Contour Plot(
X( :height, :weight ),
Y( :age ),
Show Data Points( 0 ),
Fill Areas( 1 ),
Label Contours( 0 ),
Reverse Colors( __reverse__ ),
Transform( "Range Normalized" ),
Specify Contours( Min( 12.5 ), Max( 16.5 ), N( 9 ) ),
SendToReport(
Dispatch(
{},
"Contour Plot for age",
OutlineBox,
{Set Title( "Contour Plot for age, with rev = " || Char( __reverse__ ) || " using substitute" )}
)
)
)
),
Expr( __reverse__ ), rev
)
);然而,图表的颜色仍然相反。 如果我从图表中保存脚本,我会得到:
// code from Save Script
Contour Plot(
X( :height, :weight ),
Y( :age ),
Show Data Points( 0 ),
Fill Areas( 1 ),
Label Contours( 0 ),
Reverse Colors( 1 ),
Transform( "Range Normalized" ),
Specify Contours( Min( 12.5 ), Max( 16.5 ), N( 9 ) ),
SendToReport(
Dispatch(
{},
"Contour Plot for age",
OutlineBox,
{Set Title( "Contour Plot for age, with rev = 0 using substitute" )}
)
)
);如您所见, __reverse__ 的值已正确替换为标题文本,但由于某种原因我仍然得到
Reverse Colors( 1 )
这是一个错误吗?有解决方法吗?
感谢您的帮助!
回复:等值线图平台中的反转颜色尝试将您的代码转换为 Substitute 结构,这将向 JMP 呈现 rev 的值,就像它是硬编码的一样。
rev = 1;
Eval(
Substitute(
Expr(
Contour Plot(
X( :height, :weight ),
Y( :age ),
Show Data Points( 0 ),
Fill Areas( 0 ),
Label Contours( 0 ),
Reverse Colors( __reverse__ ),
Transform( "Range Normalized" ),
Specify Contours( Min( 12.5 ), Max( 16.5 ), N( 9 ) )
)
),
Expr( __reverse__ ), rev
)
);回复:等值线图平台中的反转颜色感谢您的回复! 我在 MacOS 10.14.6 上使用 JMP 14.2.0。
我尝试了你的脚本,但仍然遇到同样的问题。 我将其添加到脚本中,因此我确信我得到了正确的输出:
SendToReport(
Dispatch( {}, "Contour Plot for age", OutlineBox, {Set Title( "Contour Plot for age, with rev = " || Char( rev ) )} )
)图表看起来像这样(我还填充了轮廓以使其更明显):


和以前一样,如果我硬编码
Reverse Colors( 0 )
然后我得到这个(这是正确的):

希望这可以帮助。 谢谢!
回复:等值线图平台中的反转颜色我在 JMP 12 和 JMP 15 中运行了下面的脚本,它们都运行正常,没有错误。如果你能提供更多细节,我也许能够深入讨论这个问题。
rev=1;
Contour Plot(
X( :height, :weight ),
Y( :age ),
Show Data Points( 0 ),
Fill Areas( 0 ),
Label Contours( 0 ),
Reverse Colors( rev ),
Transform( "Range Normalized" ),
Specify Contours( Min( 12.5 ), Max( 16.5 ), N( 9 ) )
)
我使用 Big Class 示例数据表进行测试。