疊加圖自定義顏色(行顏色)為了繪製疊加圖,我有一個 JMP 數據表,其中我以編程方式對每個設備的行進行了顏色編碼。 (有 100,000 行的大表)當我在疊加圖 X 與 Y 上繪製時,顏色顯示正確(點是行顏色)。每個設備有幾千個點,並且來自每個設備的所有數據始終具有相同的行顏色。
當我按設備對繪圖進行分組時,JMP 會分配自己的配色方案,而不是行的顏色。 (在這種情況下不是我想要的)
對於我的繪圖,我不想顯示點,而是想用一條線連接這些點,並且我希望連接器顏色是我的行的顏色。
JMP 使連接器顏色成為恆定顏色,而不是我的行的顏色。 我可以獲得不同連接器顏色的唯一方法是按設備分組。 但如果我按設備分組,顏色將不再與我的行顏色匹配!
我的數據表確實有 R、G、B 值列,因此我可以使用它,但不確定該怎麼辦?
順便說一句,我在使用 GraphBuilder 執行此任務時也遇到了類似的問題......
任何建議,將不勝感激!
謝謝,
克里斯
回复:疊加圖自定義顏色(行顏色)謝謝你! 這對我有用。
回复:疊加圖自定義顏色(行顏色)幾年前我問過類似的問題。 這是線程:
https://community.jmp.com/t5/Discussions/How-to-create-a-legend-in-Graph-Builder-which-preserves-row/mp/7983#M7977
回复:疊加圖自定義顏色(行顏色)__fList__ 和 __mList__ 是 Substitute() 函數中的佔位符。看
幫助==腳本索引==>函數==>替代
定義和示例
回复:疊加圖自定義顏色(行顏色)吉姆,
你能定義一下嗎
__fList__
和
__mList__
這些變量在您的代碼示例中使用但未初始化/定義?
謝謝,
克里斯回复:疊加圖自定義顏色(行顏色)克里斯,
請放心,您正在使用 JSL 來完成您想要做的事情。JSL 具有構建通用腳本的所有功能和能力。
回复:疊加圖自定義顏色(行顏色)吉姆,謝謝你的代碼,我想我明白了。 我真的很欣賞語法示例!現在對於我的情況,我需要概括它(我需要構建包含所有垃圾箱的字符串,直到運行時才知道),
我假設 __fList__ 只是您想要特定顏色的感興趣列中的值列表。所以我假設這個表達式可能會變得更大,我的列表可能有 1000 個大項目,並且我可以在表達式中有幾個不同的顏色箱。
今天晚些時候我可能有時間嘗試一下,我會讓你知道進展如何。
我看到的最困難的挑戰是為我的廣義案例構建下面的表達式,但我將首先嘗試一個硬編碼示例作為概念證明,如果我卡在表達式上,我可能會回到論壇。
再次感謝!
克里斯
Eval(
Substitute(
Expr(
dt:sex << set property( "value colors", {"F" = __fList__, "M" = __mList__} )
),
Expr( __fList__ ), fColorList,
Expr( __mList__ ), mColorList
)
);
Eval(
Substitute(
Expr(
dt:sex << set property( "value colors", {"F" = __fList__, "M" = __mList__} )
),
Expr( __fList__ ), fColorList,
Expr( __mList__ ), mColorList
)
);
// Set the row state colors
dt << Color by Column( :Sex );
回复:疊加圖自定義顏色(行顏色)這是一個腳本,可以讓您了解如何在設置行狀態顏色和/或設置值顏色列屬性時處理 RGB 顏色
Names Default To Here( 1 );
// Open a sample data table, and modify it to
// have 3 new columns representing the RGB values
dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
dt << New Column( "R" );
dt << New Column( "G" );
dt << New Column( "B" );
For Each Row(
If(
:Sex == "F",
:R = Color To RGB( "red" )[1];
:G = Color To RGB( "red" )[2];
:B = Color To RGB( "red" )[3];,
:R = Color To RGB( "purple" )[1];
:G = Color To RGB( "purple" )[2];
:B = Color To RGB( "purple" )[3];,
)
);
// Here are a couple of examples of setting colors
// The first one just sets the row colors based upon
// the RGB colors from the :R, :G, :B columns
For( i = 1, i <= N Rows( dt ), i++,
colorList = {};
colorList[1] = :R[i];
colorList[2] = :G[i];
colorList[3] = :B[i];
Row State( i ) = Color State( colorList );
);
Wait( 10 );
dt << clear row states;
Wait( 5 );
// The next example, sets the row state colors by
// first setting the "Value Colors", column
// property, and then sets the row state colors
// based upon the "Value Colors"
// To set the "Value Colors", the below commented
// statement needs to be created using JSL
/*dt:sex << set property("value colors",
{"F" = {0.670588235294118, 0.0313725490196078, 0.988235294117647},
"M" = {0.941176470588235, 0.196078431372549, 0.274509803921569}});*/
// First we will create the female RGB color list
// Find a row that has the RGB colors we desire
rowList = dt << get rows where( :Sex == "F" );
// Since all values of R,G & B will be the same, only used the first
// selected row to create the list for the females
fColorList = {};
fColorList[1] = :R[rowList[1]];
fColorList[2] = :G[rowList[1]];
fColorList[3] = :B[rowList[1]];
// Repeat for the males
rowList = dt << get rows where( :Sex == "M" );
mColorList = {};
mColorList[1] = :R[rowList[1]];
mColorList[2] = :G[rowList[1]];
mColorList[3] = :B[rowList[1]];
// Substitute into a template of the Set Property structure
// the created RGB lists for females and males
Eval(
Substitute(
Expr(
dt:sex << set property( "value colors", {"F" = __fList__, "M" = __mList__} )
),
Expr( __fList__ ), fColorList,
Expr( __mList__ ), mColorList
)
);
// Set the row state colors
dt << Color by Column( :Sex );
回复:疊加圖自定義顏色(行顏色)我很難根據您的描述直觀地了解您得到的內容,但您可能需要了解疊加圖如何通過手動選擇一些顏色並保存腳本來將自定義顏色應用於您的組。然後我認為您可以編寫自己的腳本來指定每個組所需的 RGB 值。您可能需要通過循環或其他方式構建腳本,但我確信這是可能的。
您是否有機會為數據集提供一個最小的工作示例來說明您所描述的內容?
回复:疊加圖自定義顏色(行顏色)這很有幫助,當我“標記”一列(標籤/取消標籤)並按該列著色時,行顏色現在與我按該列繪圖和分組時的顏色匹配,但現在我的問題是如何以編程方式設置該列中不同組的 RGB 值。我希望能夠通過 RGB 值設置每種顏色。 不確定 JSL sytex。我有一列用於 R、G 和 B,並且可以創建一個包含所有 3 個列的串聯列,然後按該列著色,但不確定如何以編程方式為不同組設置屬性。
回复:疊加圖自定義顏色(行顏色)我認為,通過為您正在使用的列設置列屬性“值顏色”,您會更幸運地保留所需的顏色。在大多數情況下,“值顏色”是 JMP 默認的顏色。