解
语境就是一切!正如人们可能希望在文本块中嵌入细线图一样迷你为了在讨论的上下文中显示它们,有人可能希望在地图中嵌入小条形图来比较其位置上下文中的变量。有人喜欢我们自己的 @scwise 谁在这个建议中添加了这个建议愿望清单 。
该解决方案可以使用最近的两个JMP功能实现 - 虚拟连接以及将表格单元格中的图像用作标记的功能。结合Graph Builder使用复合图形中的图形元素创建数据表的能力,我们拥有解决此难题所需的所有部分。最终结果如下:
US Elections 2008: Obama vs McCain美国大选2008:奥巴马与麦凯恩
详情如下:
dt1 = Open("$SAMPLE_DATA/US Election 2008.jmp");
// Create per state graphs
gb1 = Graph Builder(
Variables( Y( :Obama ), Y( :McCain, Position( 1 ) ), Page( :State ) ),
Elements( Bar( Y( 1 ), Y( 2 ), Legend( 8 ), Summary Statistic( "Max" ) ) ),
SendToReport(
Dispatch(
{},
"",
ScaleBox( 2 ),
{Min( -0.657608695652174 ), Max( 0.657608695652174 ), Inc( 0.25 ),
Minor Ticks( 0 )}
),
Dispatch(
{},
"",
ScaleBox( 3 ),
{Min( -0.657608695652174 ), Max( 0.657608695652174 ), Inc( 0.25 ),
Minor Ticks( 0 )}
),
Dispatch( {}, "400", LegendBox, {Set Title( "" )} )
)
);
// Save graphs as images to data table
dt2 = gb1 << Make into Data Table;
// Tip: save table to enable virtual join
dt2 << Save("$TEMP/ElectionPerStateGraph.jmp");
// Set virtual join between tables
dt2:State << Set Property("Link ID", 1);
dt1:State << Set Property(
"Link Reference",
Reference Table( "$TEMP/ElectionPerStateGraph.jmp" ));
// Use virtually joined graph column as source for markers
col = Column(dt1, "Graph[State]");
col << UseForMarker( 1 );
// Create map with a points overlay using graph markers
dt1 << Graph Builder(
Size( 534, 456 ),
Show Control Panel( 0 ),
Variables( Shape( :State ) ),
Elements( Map Shapes( Legend( 2 ) ), Points( Legend( 3 ) ) )
);