How to manipulate the area graph?
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Legend 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!