How can I change the edge line color when using the 'fill' function in MATLAB?

21,407

Solution 1

See this thread:

To set the edgecolor to white do the following.

h = fill([-1 -1 1 1],[-1 1 1 -1],'w');
axis([-2 2 -2 2]);
set(h,'edgecolor','white');

that should take care of the border.

Solution 2

In addition to schnaader's answer, you can also set the edge color in the initial call to FILL:

hPatch = fill(xData,yData,'r','EdgeColor','r');  %# Red patch with red edges

Or stop the edges from being drawn altogether:

hPatch = fill(xData,yData,'r','EdgeColor','none');  %# Red patch with no edges
Share:
21,407
Ahmad
Author by

Ahmad

Updated on April 16, 2020

Comments

  • Ahmad
    Ahmad about 4 years

    I'm writing code in which I use MATLAB's fill command to plot 2D shapes. I can specify the fill color of the shape. However, the border line color is always black. I want the border line color the same as the fill color. How can I also specify the border line color?