How to manipulate the area graph?

조회 수: 2 (최근 30일)
Michelle Sy
Michelle Sy 2014년 3월 6일
편집: Michelle Sy 2014년 3월 11일
Enter the following data into the Matlab command window: year = [ 1980 1985 1990 1995 2000 2005 2010 ]'; airtime_music = [ 95 83 65 40 20 10 5 ]'; airtime_musicawards = [ 0 12 20 30 30 30 30 ]'; airtime_other = 100 - airtime_music - airtime_musicawards; Create a graph that looks exactly like the graph below. You can use the following commands: plot, xlim, ylim, xlabel, ylabel, legend, title.
So I tried recreating the image below but then the red parts and the green parts are not in the right place. I used
>>area(airtime_music,'facecolor','b')
>>hold on
>>area(airtime_musicawards,'facecolor','g')
>>hold on
>>area(airtime_other,'facecolor','r')
but then the graph that I keep coming up with just overlaps with each other rather than having three different colors from red green and blue like the image. The blue part comes out right but not the red and green one. Is there anyway I can flip the red and green parts where their x values are on the top instead of the bottom?

답변 (0개)

카테고리

Help CenterFile Exchange에서 Legend에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by