bar plot loses edge colour
조회 수: 18 (최근 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];
댓글 수: 0
채택된 답변
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.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Spline Postprocessing에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!