How to set edgecolor same as the facecolor while drawing polygos in matlab? -


i plotting many polygons using command fill.

fill(x1,y1,1) fill(x2,y2,2) ... 

i want set edge color same face color. have that?

plotting many polygons , need find way set edgecolor same facecolor. facecolors not known me.

have use numbers, because plotting data.

i don't what's wrong suggestion of citizeninsane, if want save code use little helper function:

fillitlikeiwant = @(x,y,color) fill(x, y, color, 'edgecolor',color)  fillitlikeiwant(x,y,'r') 

alternatively can define "styles" in advance, thats how line plots, in array this:

mystyles = {{'r','edgecolor','r'};             {'b','edgecolor','b'};             {'g','edgecolor','g'}} 

and iterate through styles:

for ii = 1:3     fill(x,y,mystyles{ii}{:}); hold on end 

edit:

i don't know single number 1 or 2 in example fill(x1,y1,1) supposed do, maybe want create , use colormap this:

n = 500; cmap = colormap(jet(n)); 

now use helper function , every polygon gets color of cmap.

for ii = 1:500     h{ii} = fillitlikeiwant(x,y,cmap(ii,:)); end 

you can keep track of colors indices. alternatively save handles of every single polygon. afterwards can color of polygon handle:

get(h{500},'facecolor')  ans =          0.504            0            0 

which same as:

cmap(500,:)  ans =          0.504            0            0 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -