等值線圖平台中的反轉顏色我有一個腳本,它迭代多個列並產生等值線圖。
如果列值為負,我想反轉輪廓顏色,所以我設定一個如下變數:
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 範例資料表進行測試。