Transparent patches in the main figure, but no transparent patches in the legend
Mostra commenti meno recenti
In the following example, how can I have transparent patches in the main figure and No transparent patches in the legend?
N = 100;
x = linspace(0,1,N);
y1 = repmat([-2;2],1,N);
y2 = repmat([-1;1],1,N);
figure; hold on;
h1 = fill([x flip(x)], [y1(1,:) flip(y1(2,:))],'r');
h2 = fill([x flip(x)], [y2(1,:) flip(y2(2,:))],'g');
ylim([-2,2]);
first = legend('area1','area2','NumColumns',2);
PatchInLegend = findobj(first.PlotChildren, 'type', 'patch');
% Here below, FaceAlpha is applied to both patches in the main figure
% and in the legend - But I would need the transparency only for the main figure's patches
set(PatchInLegend(1), 'FaceAlpha', 0.2);
set(PatchInLegend(2), 'FaceAlpha', 0.4);
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Polygons in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

