Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 342
Ahmad Avatar asked Sep 25 '10 21:09

Ahmad


2 Answers

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
like image 38
gnovice Avatar answered Sep 28 '22 06:09

gnovice


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.

like image 193
schnaader Avatar answered Sep 28 '22 05:09

schnaader