Color legend for a single graphics object

1 次查看(过去 30 天)
Context: I'm working with a M-by-3 that I've categorized into 4 different groups. As part of the visualization of this data, I'm creating a MechE-style 4 view drawing. The 4 groups are defined by 4 logical masks of length M.
Problem: I would like to have annotation, legend, or similar to explain the color-coding I've applied to 3 of the views in this figure (a scatter, a scatter3, and a third yet-be-be-determined object). So far, the only solutions to this are inelegant at best. My own solution (below) isn't much better.
%minimum code snippet
colormap(AxHandIso,[[1 0 1 0.9290]',[1 1 0 0.6940]',[0 0 0 0.1250]']);
colorbar(AxHandIso,'Ticks',[0.125 0.375 0.625 0.875],'TickLabels',{'What Yellow Means','What Green Means',...
'What Red Means','What Orange Means'});
ColourLegend = legend(AxHandIso,'EnoughTextToPreventClippingColorBar'); ColourLegend.Visible = 'off';
Question: Is there a better/more elegant way to create an annotation which occupies the same space as a legend in the WestOutside Position, automatically resizes the axes object(s) in a figure to accomodate itself, work within a tiledlayout, and does not involve creating superfluous graphics objects?
Side Question: Why doesn't lcolorbar accept a target argument?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Legend 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by