Format adjustment for combination of line and area figures
조회 수: 2 (최근 30일)
이전 댓글 표시
Dear all,
I am trying to create a plot, which combines an area plot and a line plot, which should be like the following. More specifically, I want the plot area to be divided into two regions, the grey and the white one, which they should be blended, as the main plot, I want to show is the line (or lines).
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/876810/image.jpeg)
However, for my datasets, the result, according to the code that I attach in this post, is the following:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/876815/image.jpeg)
Apparently, recognises areas as individual plots, whereas I want it to only build the area outline. In addition, the created white area is on top of the gridlines,whereas I want, as it is shown on the example chart, to be blended with the rest of the plot area.
Does anybody have any recommendations on how to overcome those issues?
Thank you very much,
Ioannis Voultsos.
figure (11)
%plot of area above x axis
area(radial_position,AoA_stall,'facecolor','w','facealpha',1,'edgealpha',0)
hold on
%plot of area below x axis
area(radial_position,AoA_neg,'facecolor','w','facealpha',1,'edgealpha',0)
ylim([-2 12])
%grey figure background
set(gca,'color', [0.83 0.83 0.83]);
hold on
%plot first data series
plot(radial_position,AoA_stdw_no_shear_pstill(4,:),'-s','LineWidth',1.5)
hold on
%plot second data series
plot(radial_position,AoA_stdw_shear_pstill(4,:),'-o','LineWidth',1.5)
grid on
title('Angle of Attack for windspeed=9 m/s')
xlabel('Radial Position r/R (-)')
ylabel('Angle of Attack (deg)')
legend('Uniform wind,no wind shear','Uniform wind,wind shear','location','southwest','color','w')
set(gca,'FontSize',12)
댓글 수: 0
채택된 답변
Voss
2022년 1월 28일
To get the grids on top of the areas, set the 'Layer' property of the axes to 'Top':
figure()
area([0.2:0.1:0.9 0.98]+0.02,[11 8 9 10 9 8 6 6 6].','facecolor','w','facealpha',1,'edgealpha',0)
grid on
set(gca, ...
'color', [0.83 0.83 0.83], ...
'Layer','top')
추가 답변 (0개)
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!