我需要在 2 和 4 之間繪製一個 x 到陰影區域,但是遇到了障礙,表面部分感覺沒有好的方法可以做到這一點,並且我需要找到該點的 x 座標兩條線相交。
以及如何擺脫頂部和右側的黑框線。
names default to here(1);
new window("Ex",
gb=graph box(
framesize(300,300),
x scale(-6,6),
y scale(0,20),
double buffer,
pen color(3);
y function(x*x,x);
pen color(4);
Vline(2,0,4);
vline(4,0,16);
yfunction(x-2,x,max(4),min(2));
yfunction(x-2.5,x,max(4),min(2));
yfunction(x-3,x,max(4),min(2));
yfunction(x-3.5,x,max(4),min(2));
yfunction(x,x,max(4),min(2));
yfunction(x-0.5,x,max(4),min(2));
yfunction(x-1,x,max(4),min(2));
yfunction(x-1.5,x,max(4),min(2));
yfunction(x+0.5,x,max(4),min(2));
yfunction(x+1,x,max(4),min(2));
yfunction(x+1.5,x,max(4),min(2));
)
);嗨@lehaofeng ,
我其實不明白你所問的一切。所以讓我幫助你(我想你問的是)頂部/右側的黑線:
只需右鍵單擊圖表 > 邊框 > 取消選擇“頂部”和“右側”

會給你這個:

希望這可以幫助,
佛洛里安
您可以使用帶有彩色填滿圖案的多邊形。
Names Default to Here( 1 );
// integration resolution
nSteps = 25;
// function range for AUC
xMin = 2;
xMax = 3;
// define function
fxn = Function( {x},
Return( x:*x );
);
// define polygon along top
polyX = Index( xMin, xMax, 1/nSteps );
polyY = fxn( polyX );
// finish (close) polygon
polyX ||= Transpose( Matrix( Eval List( List( xMax, xMin, xMin) ) ) );
polyy ||= Transpose( Matrix( Eval List( List( 0, 0, 4 ) ) ) );
New Window( "AUC",
Outline Box( "Plot",
Graph Box(
X Scale( -5, 5 ),
Y Scale( 0, 25 ),
Pen Color( "Black" );
Y Function( fxn( x ), x );
Fill Color( "Green" );
Fill Pattern( "right slant light" );
Polygon( polyX, polyY );
)
),
Outline Box( "AUC",
Table Box(
String Col Box( "Method", { "Polygon", "Calculus" } ),
Number Col Box( "Estimate", { Polygon Area( polyX, polyY ), 19/3 } )
)
)
);