Deleting axes changes legend transparency?
Show older comments
I'm making a plot using gplotmatrix. I only need the lower half of the plot beneath the diagonal, so I have removed the upper half of the plot by setting the visibility of the axes and data points to 'off'.
However, in deleting these objects, the legend becomes slightly transparent, and after trying many fixes I have not been able to make the legend opaque.
I do not know if this is a bug or a feature, but any suggestions of how to remedy it are much appreciated. I've included before/after images as well as code that replicates this issue. Thanks!
x = rand(100,5);
group = zeros(100,1);
group(1:33) = 1;
group(34:66) = 2;
group(67:end) = 3;
figure(1)
[h,ax,bax] = gplotmatrix(x,[],group,[],[],[],'on','hist',[],[])
figure(2)
[h,ax,bax] = gplotmatrix(x,[],group,[],[],[],'on','hist',[],[])
% Remove axes in upper triangular portion of the gplotmatrix plot
for i = 1:5
for j = i+1:5
set(ax(i,j),'Visible','off');
set(findobj(ax(i,j),'type','line'),'Visible','off');
end
end
% Attempt (unsuccessfully) to force legend text color
leg = findobj(gcf,'Tag','legend')
set(leg,'Location','south','Orientation','horizontal','TextColor',[0, 0, 0, 1]);
Accepted Answer
More Answers (0)
Categories
Find more on Legend in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!