Question
How can I plot arrays with markers in the default marker colors but with filled markers? Plot(x,'o') plots empty circles in default colors for each column of x. I want the same with filled circles.
Expert Answer
Neeta Dsouza
PhD Expert
Answered Sep 11, 2026
For this example, I have specified the array "x" to be an arbitrary 4x4 array of random numbers; however, you can specify it as your own array. You can use the "MarkerFaceColor" and "Color" properties of the plotted line or lines in order to fill in the markers with the same color as the default marker edge color.
Try the following sample code:
x = 1:4;
y = rand(4);
figure
h = plot(x, y, 'o');
set(h, {'MarkerFaceColor'}, get(h,'Color'));
The "Color" property of a line stores the RGB value of that line, whether it is a default or custom-set value. You can use the "get" function in order to retrieve this value. Next, you can use the "set" function in order to apply this RGB value to the line's "MarkerFaceColor" property, which determines the fill color of the marker.
If your plot has multiple lines, then "get" will return a cell array of RGB values corresponding to the "Color" property of each line. Similarly, "set" will need to use cell arrays in order to set the RGB values of the "MarkerFaceColor" of each line, so we must input both our "MarkerFaceColor" property and the corresponding RGB values from "get" as cell arrays.
You can also use scatter function with 'filled' option if you just want to plot a marker.
x = 1:4; y = rand(4); figure hold for n = 1:4 scatter(x,y(:,n),'filled') end
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related Array Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →