필터 지우기
필터 지우기

Color legend for a single graphics object

조회 수: 1 (최근 30일)
Gabriel Stanley
Gabriel Stanley 2023년 5월 4일
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