How to manipulate the area graph?

2 次查看(过去 30 天)
Michelle Sy
Michelle Sy 2014-3-6
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