MATLAB Answers

how to fill histogram legend markers

45 views (last 30 days)
sani
sani on 24 Feb 2021
Commented: sani on 24 Feb 2021
hello,
I'm plotting using histograms, and when I insert legend into the plot, the rectangles are hollow.
I'd like them to be filled but couldn't find any documentation about how to do it.
is it even possible?

Answers (1)

KALYAN ACHARJYA
KALYAN ACHARJYA on 24 Feb 2021
Edited: KALYAN ACHARJYA on 24 Feb 2021
I tried to reproduce the same error, I did not get it
data1=randi(10,[1,100]);
data2=randi(10,[1,100]);
histogram(data1,'FaceColor','r');
hold on;
histogram(data2,'FaceColor','b');
legend('Data1','Data2')
Can you confirm it?
  3 Comments
sani
sani on 24 Feb 2021
so the only way is to find alternative way to display the data?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by