- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
How to add a marker line to the surface part of the green area and get rid of the black box lines on the top and right side?
I need to draw an x between 2 and 4 to a shaded area, but have hit a snag, the surface part doesn't feel like there is a good way to do it, and I need to find the x coordinates of the point where the two lines intersect.
And how to get rid of the black box lines on the top and right side.
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));
)
);
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to add a marker line to the surface part of the green area and get rid of the black box lines on the top and right side?
Created:
Jan 30, 2024 10:32 AM
| Last Modified: Jan 30, 2024 10:30 AM
(1281 views)
| Posted in reply to message from lehaofeng 01-30-2024
You might use a polygon instead with a colored fill pattern.
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 } )
)
)
);
4 REPLIES 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to add a marker line to the surface part of the green area and get rid of the black box lines on the top and right side?
Hi @lehaofeng ,
I don't actually get all you're asking. So let me help you with (I think your asking about) the black lines top/right:
Simply Right-Click in the Graph > Border > deselect 'Top' and 'Right'
Will give you this:
Hope this helps,
Florian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to add a marker line to the surface part of the green area and get rid of the black box lines on the top and right side?
Thanks!I hope to achieve the effect as shown in the diagram below
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to add a marker line to the surface part of the green area and get rid of the black box lines on the top and right side?
Created:
Jan 30, 2024 10:32 AM
| Last Modified: Jan 30, 2024 10:30 AM
(1282 views)
| Posted in reply to message from lehaofeng 01-30-2024
You might use a polygon instead with a colored fill pattern.
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 } )
)
)
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to add a marker line to the surface part of the green area and get rid of the black box lines on the top and right side?
Thanks!It works!