How to color RED to the lower portion of the curve

조회 수: 2 (최근 30일)
Atom
Atom 2013년 4월 18일
How to color RED to the lower portion of the curve y=x^2
x = 1 : 0.1 : 10;
y = x.^2;
plot(x,y)
axis([1 10 0 100])

채택된 답변

Kye Taylor
Kye Taylor 2013년 4월 18일
Replace the
plot(x,y)
command with
area(x,y,'FaceColor',[1 0 0])
  댓글 수: 6
Atom
Atom 2013년 4월 18일
Please suggest about the meaning of patch([x,0],[y,100],'b').
Kye Taylor
Kye Taylor 2013년 4월 19일
the first two inputs to patch can be thought of as points that define vertices of some polygon. the vectors x and y are the lower parts of that polygon. By adding a point (0,100) to the set of vertices, we get the top left corner of the polygon. Without that vertex, the behavior was as you said above, only the "upper portion" was colored instead of the "whole upper part".

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surfaces, Volumes, and Polygons에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by