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).
However, for my datasets, the result, according to the code that I attach in this post, is the following:
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)

采纳的回答

Voss
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 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by