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 的情況下獲得圖片或圖標的唯一方法是為每個標記製作單獨的圖片段。 它們可以逐段定位。