How to color RED to the lower portion of the curve

1 Ansicht (letzte 30 Tage)
Atom
Atom am 18 Apr. 2013
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])

Akzeptierte Antwort

Kye Taylor
Kye Taylor am 18 Apr. 2013
Replace the
plot(x,y)
command with
area(x,y,'FaceColor',[1 0 0])
  6 Kommentare
Atom
Atom am 18 Apr. 2013
Please suggest about the meaning of patch([x,0],[y,100],'b').
Kye Taylor
Kye Taylor am 19 Apr. 2013
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".

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Animation finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by