cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
lehaofeng
Level IV

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

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?

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 } )
		)
	)
);

 

poly.JPG 

View solution in original post

4 REPLIES 4

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'

Florian_Vogt_0-1706608076608.png

Will give you this:

Florian_Vogt_1-1706608149506.png

 

 

Hope this helps,

Florian

 

lehaofeng
Level IV

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

lehaofeng_0-1706624493302.png

 

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?

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 } )
		)
	)
);

 

poly.JPG 

lehaofeng
Level IV

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!