Plot doubt: how to fill the squares.

74 views (last 30 days)
Hello, I am using plot function to plot some data at the same time:
The problem I have is that the squares I have in the plot are empty and I can not fill them with any colour. How could I solve the problem?
Thank you,

Accepted Answer

Evan on 19 Aug 2014
Edited: Evan on 19 Aug 2014
Try using the MarkerFaceColor property.
x = 0:pi/32:2*pi;
y = sin(x);
z = cos(x);
plot(x,y,'s',x,z,'-','MarkerFaceColor',[0 0 0])
That seems to work fine, since your second set of data is plotted with a line marker, but you could always also split them up into separate plot commands if you for some reason wanted to control the marker face color of each.
Andoni Mendialdua
Andoni Mendialdua on 20 Aug 2014
Thank you very much Evan. I solved the problem:)

Sign in to comment.

More Answers (0)


Community Treasure Hunt

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

Start Hunting!

Translated by