bar plot loses edge colour

12 次查看(过去 30 天)
Hi,
I am trying to plot a bar graph but the edge colour of the bars is not showing up. If i plot anything except the full matrix (ie bar(A(2:end,:),'stack') or A(1:end-1,:)) then the edge color is showing up fine. The matrix A has a lot of zeros in it which I think might be causing the trouble.
for example: this is the result from bar(A,'stack'):
whereas this is the result from bar(A(2:end,:):
Can anyone shed some light onto why this is happening? I tried forcing the edge colour ( 'EdgeColor','k','LineStyle','-') but this didnt fix it. I am using 2014a
Thanks very much!
A=[0.00709239508216482,0.00668228249785818,0.00657912334207632,0.00653407043637480,0.00650745876058859;0.00753720842859957,0.00712686803745401,0.00698222122280358,0.00687675714958216,0;0.00546340286287907,0.00489054247152450,0,0,0;0.00482661773229318,0.00478936774724386,0.00442913337387775,0,0;0.00398499467939313,0.00400716695958556,0.00399266317040081,0,0;0.00490116804792129,0.00486445606019397,0.00444425715916304,0,0;0.00573736716549212,0.00511212234220712,0,0,0;0.00285420619668309,0,0,0,0;0.00176775615451821,0,0,0,0;0.00159233623454622,0,0,0,0;0.00261857291942421,0,0,0,0;0.00108357003117622,0,0,0,0;0.00114561800194367,0,0,0,0;0.000716112570043777,0,0,0,0;0.000977525236796560,0,0,0,0;0.000826360921384716,0,0,0,0;0.00444425715916304,0,0,0,0;0.00511212234220712,0.000826360921384716,0,0,0;0.00687675714958216,0,0,0,0;0.00650745876058859,0,0,0,0;0.00489054247152450,0.00108357003117622,0,0,0;0.00442913337387775,0,0,0,0;0.00698222122280358,0,0,0,0;0.00653407043637480,0,0,0,0;0.00657912334207632,0,0,0,0;0.00486445606019397,0,0,0,0;0.00712686803745401,0,0,0,0;0.00668228249785818,0,0,0,0;0.00478936774724386,0,0,0,0;0.00399266317040081,0.00159233623454622,0.00261857291942421,0.000977525236796560,0;0.00400716695958556,0.00176775615451821,0.00285420619668309,0.00114561800194367,0.000716112570043777];

采纳的回答

Mike Garrity
Mike Garrity 2014-9-29
That's the default behavior when the amount of data gets too large. The thinking was that all of those black lines would clutter the picture up. You can override it by explicitly setting the EdgeColor like this:
h = bar(A,'stack')
set(h,'EdgeColor','black')
I think that the magic number is somewhere are 150. How many values are in A?
I'm not sure why setting the EdgeColor at the end of the bar command didn't work.
  1 个评论
James
James 2014-9-29
Hi, Thanks very much, that sorted it out! The default behaviour does make sense, I wasnt aware it did anything clever like that. Knowing that using set(h,...) has a different behaviour than changing it in the bar command is useful, im sure that would have solved some of my other problems I had a while back!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Spline Postprocessing 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by