How to manipulate the area graph?

2 views (last 30 days)
Michelle Sy
Michelle Sy on 6 Mar 2014
Edited: Michelle Sy on 11 Mar 2014
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?

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!