JMP 社区您好,
与图形脚本命令“圆形”、“椭圆形”和“矩形”类似,是否可以在 FrameBox 中插入自定义形状、图标或图片?
值得注意的是,我是不是寻找自定义数据点标记。
这是我正在使用的图形脚本类型的片段(gb 是图形生成器热图),我想用自定义形状替换圆:
gbr = report (gb);
fb = gbr [FrameBox (1)];
fb << add graphics script (
Fill color (black);
For (i = 0, i <= 24, i++,
For (j = 0.5, j <= 7, j = j+2,
r = (i*8) + (j+0.5);
s = column (dt,"SIZE FDR") [r] / 8;
if (s < 0.02, s = 0.02);
circle ({i,j}, s, "FILL")
)
);
);
感谢您的帮助。
最好的,
TS
还有一个像素路径()功能。 如果您遇到性能问题(可能有数千个点),PixelPath 允许重新定位、调整大小和旋转现有路径。 (我不知道如何做到这一点小路() .) 您可以预先创建一次星星,然后将它们与 PixelPath 一起重复使用。
拉伸图形时,Path() 和 PixelPath() 的行为有所不同:Path 在用户坐标中绘制,并且绘图拉伸以适合当前轴。 PixelPath 以像素为单位绘制,并且符号不改变大小。
脚本索引有 PixelPath 的示例;使用 PixelOrigin(x,y) 并将 h,v 保留为 0,0。
N-pointed starsN-pointed starsN 角星
makestar = Function( {x, y, npoints, inside, outside},
{p = J( 2 * npoints, 3, . ), angle, i, move = 1, draw = 2},
For( i = 1, i < N Rows( p ), 0,
angle = 2 * Pi() * i / N Rows( p );
p[i, 1] = x + Sin( angle ) * inside; // sin and cos are reversed here to
p[i, 2] = y + Cos( angle ) * inside; // make the point be at the top.
p[i, 3] = If( i == 1, move, draw ); // swap sin/cos for point at left.
i += 1;
angle = 2 * Pi() * i / N Rows( p );
p[i, 1] = x + Sin( angle ) * outside; // ditto
p[i, 2] = y + Cos( angle ) * outside;
p[i, 3] = If( i == N Rows( p ), -draw, draw );
i += 1;
);
p; // return
);
New Window( "Example",
gb = Graph Box(
xaxis( Show Major Grid( 1 ) ),
yaxis( Show Major Grid( 1 ) ),
framesize( 500, 500 ),
Pen Color( "red" );
Pen Size( 3 );
Fill Color( "blue" );
npoints = 3; // each star gets more points below
For( xx = 20, xx <= 80, xx += 20,
For( yy = 20, yy <= 80, yy += 20,
// the inside/outside ratio needs to change with more points...
p = makestar( xx, yy, npoints, 2 + npoints / 4, 8 );
Path( p, 1 ); // blue solid fill
Path( p, 0 ); // red outline
npoints += 1;
)
);
)
);
// move the grid lines above the stars
grid = gb[framebox( 1 )] << find seg( SegPlaceholder( 1 ) );
// grid is the original, below the stars
gb[framebox( 1 )] << appendseg( grid ); // makes a copy above
// probably not needed...they are on top of each other...
grid << delete; // delete the original from below
路径()函数?
贝塞尔插值和使用 Path() 的贝塞尔树(脚本索引可能有更简单的非贝塞尔例子。)
此外,列属性 UseForMarker 适用于图片列,但听起来您可能没有每个标记的数据点。
我认为在没有 UseForMarker 的情况下获得图片或图标的唯一方法是为每个标记制作单独的图片段。 它们可以逐段定位。