你好
尝试突出显示双变量图中特定行的标记。
我手动创建了绘图并将其保存到脚本窗口,并手动选择“主题”列作为行图例。
但问题是,当我查看脚本时,我没有在脚本中看到上述步骤!
这就是我的意思
dt = Open( "$sample_data/Hollywood Movies.jmp" );
dt = currentdatatable(); // Don't know I need this here anyway
Bivariate(
Y( :Domestic Gross ),
X( :Foreign Gross ),
Fit Where( :Genre == "Action", Fit Line( {Line Color( {212, 73, 88} )} ) ),
Fit Where(
:Genre == "Adventure",
Fit Line(
{Line Color( {61, 174, 70} )},
{Set α Level( 4.06068261874589e-315 )}
)
),
Fit Where( :Genre == "Animation", Fit Line( {Line Color( {66, 112, 221} )} ) ),
Fit Where( :Genre == "Comedy", Fit Line( {Line Color( {204, 121, 41} )} ) ),
Fit Where( :Genre == "Drama", Fit Line( {Line Color( {40, 182, 143} )} ) ),
Fit Where( :Genre == "Fantasy", Fit Line( {Line Color( {162, 43, 221} )} ) ),
Fit Where( :Genre == "Horror", Fit Line( {Line Color( {196, 189, 43} )} ) ),
Fit Where( :Genre == "Romance", Fit Line( {Line Color( {39, 174, 174} )} ) ),
Fit Where( :Genre == "Thriller", Fit Line( {Line Color( {197, 41, 201} )} ) ),
SendToReport( // What does this mean here ? Why we need this ?
Dispatch( // What does this mean here ? why we need this ?
{},
"Bivar Plot",
FrameBox,
{Frame Size( 377, 299 ), Row Legend(
Theme,
Color( 1 ),
Color Theme( "JMP Default" ),
Marker( 1 ),
Marker Theme( "Standard" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
)
)
);这创造了

我想要做的是控制哪一列作为行图例并突出显示该列中的行。 像这样的东西

我确信手册中不存在这一点。
Names Default To Here( 1 );
dt = New Table( "Example",
Add Rows( 15 ),
New Column( "sex",
Character,
"Nominal",
Set Values(
{"F", "F", "F", "F", "F", "M", "M", "M", "F", "F", "F", "M", "M", "M",
"M"}
)
),
New Column( "height",
Numeric,
"Continuous",
Format( "Best", 10 ),
Set Values( [59, 61, 55, 66, 52, 60, 61, 51, 60, 61, 56, 65, 63, 58, 59] )
),
New Column( "weight",
Numeric,
"Continuous",
Format( "Best", 10 ),
Set Values(
[95, 123, 74, 145, 64, 84, 128, 79, 112, 107, 67, 98, 105, 95, 79]
)
),
Set Row States(
[192, 193, 193, 193, 193, 32833, 32833, 32832, 192, 192, 192, 32832, 32832,
32832, 32832]
)
);
// Here is the Bivariate Platform. It will honor the rowstates
// I have provided some selections, etc. but you can change them
// to whatever selections you want
Bivariate(
Y( :height ),
X( :weight ),
Fit Where( :sex == "F", Fit Line( {Line Color( "Medium Dark Red" )} ) ),
Fit Where( :sex == "M", Fit Line( {Line Color( "Medium Dark Blue" )} ) )
);
// Here is the code to create the new rowstate column
// But it can easily be done manually by just creating a new
// column, and then going to the Col Info window, and setting the
// data type to Row State
dt << New Column( "The RowStates", rowstate );
// This is the command that copies the rowstates from the
// rowstate column, to the new column called The RowStates<BR />// To do this interactively just go to the column panel and<BR />// right click on the red star in front of the new column<BR />// and select "Copy From Rowstates"
dt:The RowStates << copy from rowstates;
// dt:The RowStates << Hide(1); // This will hide the column from view
// The rest is manual(interactive);
// Go to the red triangle on the Bivariate output and select
// Save Script==>To Data Table
// Once it is saved, Go to the green triangle in front of the script that was just
// saved to the data table. Right click on the green triangle and select Edit
// Now add the following line as the first line
// :The RowStates << Copy to Row states;
// Make sure you remove the // from the front of the line
// Now, whenever you run the script, the row states from when you created the graph
// will be applied before the graph is created感谢您的长解释。 确实非常有帮助。 我喜欢这个部分“您认为是图表突出显示了点(标记)。但可惜的是,控制突出显示的是数据表。 ” 这是一个很好的解释。
OTH,第 2 项的问题如何做到这一点? 对于拥有多年经验的你来说,只需一秒钟即可将其写入 jsl,但对于我来说,需要一周的时间才能找出你的真正含义或如何付诸实践。 我希望您发布一些脚本来展示您的思维过程,这样也许其他人也能从中受益;)
绘图上特定标记(点)的突出显示以及其余标记的随后淡出实际上链接到数据表,以及在数据表中选择了哪些行。 如果您转到具有根据其列创建的双变量散点图的数据表,并选择数据表中的一行,则双变量图中的点将突出显示,所有其他点将变淡。这种在数据表中选择行并在与数据表关联的所有图表中突出显示该行的行为是 JMP 的主要原则之一。因此,当您单击图表中的特定图例或图表中的一组点(标记)时,您看到的行为实际上并不指示图表突出显示这些点,但实际上,它是告诉数据表选择数据表中的特定行,然后数据表中的该操作告诉所有相关图形突出显示图形中表示所选行中的数据的点。这种行为从 JMP 一开始就存在。现在,我为什么要花那么多时间来告诉你这些。好吧,您对不理解为什么突出显示的数据点没有在保存的脚本中捕获的描述向我暗示,您认为是突出显示点(标记)的图表。但可惜的是,控制突出显示的是数据表。也就是说,使图表具有所需突出显示的一种方法是选择数据表中需要选择的行来制作突出显示标记,然后保存数据表。数据表中的行选择将被保存,当打开并运行图形脚本时,它将根据需要显示图形。这通常不是选择的解决方案。处理要突出显示的标记的其他三种方法通常是更好的选择。
- 手动将代码添加到脚本中,专门选择所需的行;
- 创建数据类型“rowstate”的新列,根据需要设置数据表选择、标记等,以便按照您希望显示的图形显示,然后将 Rowstates 保存到新列行状态列。然后,您要做的就是在保存的脚本中添加语句,将所需的行状态值从行状态列复制回数据表的行状态,然后生成图形。
- 使用本地数据过滤器进行行选择。本地过滤器不会物理选择数据表中的行。相反,它为特定平台提供了一个虚拟选择环境,就像在数据表本身中进行选择一样。本地数据过滤器保存在已保存的脚本中。
我希望这是有道理的。如果您还有更多问题,请询问他们。