Stack of coloured text labels to replace the colour bar and legend?
Show older comments
This would be a nice compact way of combining colorbar and legend. I can set up different colored lines using the function 'varycolor' from the file exchange, but a list of text labels of corresponding color alongside the figure seems more difficult (see example image). The best I can get is to use a colorbar, with each color grade corresponding to a plot line:
ColorSet = varycolor(10);
figure;
set(gca, 'ColorOrder', ColorSet);
hold all;
for k=1:10
plot(J(k).time,J(k).variable,'.-');
end
legend off;
set(gcf, 'Colormap', ColorSet);
colorbar;
It seems pretty difficult to have multiple colored text lines within a single text box or legend, and tedious to position multiple text boxes along the length of the y axis. Any help would be great!
Answers (0)
Categories
Find more on Labels and Annotations 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!