Format adjustment for combination of line and area figures

1 回表示 (過去 30 日間)
Ioannis Voultsos
Ioannis Voultsos 2022 年 1 月 28 日
コメント済み: Ioannis Voultsos 2022 年 1 月 28 日
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')
  1 件のコメント
Ioannis Voultsos
Ioannis Voultsos 2022 年 1 月 28 日
It works perfectly.Thank you very much.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-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