How to add only a fragment of bar to bar graph (not from 0)?
3 次查看(过去 30 天)
显示 更早的评论
Hello. I am trying to modify my bar graph. I have a several datas, limited x asis (in a way I want) and I would like to add only a fragment (not from 0 but from d1 to d1+t1, I calculated d1 and t1) of two bars (with different colors) to existing to bars. When I'm trying to plot h3=bar([uHV_sr1 - t1, uHV_sr1 + t1], [d1,1d1], 4, 'm'); all green on this plot (not from some poinnt, for example 300=d1) comes into magenta.
I am not keen on Matlab and I tried several ways to manage it (with set for example), but failed. I am working on 2013 release. How can I solve it?
figure(1)
h1=bar(uHV_sr1, d1,4,'g'); %x1 i x2 to rzędna i odcięta jak zwykle, 1 to "szeroko?ć na stronę" słupka i ostatni to kolor
hold on
h2=bar(uHV_sr1, d1,0.2,'k') ;
%h3=bar([uHV_sr1 - t1, uHV_sr1 + t1], [d1,1d1], 4, 'm');
ax=h3
set(h3, 'yticklabel');
%h3lim ([290 398])
hold on
h4=bar(uHV_sr2, d2,5, 'b');
h5=bar(uHV_sr2, d2,0.65,'c');
%hold on
xlim ([290 398])
%legend('1','2','3','4', 'Location','best')
xlabel ('5')
ylabel ('{\mu')
%title('Za jakie grzechy? ')
0 个评论
回答(2 个)
Walter Roberson
2018-2-2
For any one barseries object, you can set the BaseValue property; see https://www.mathworks.com/help/releases/R2013a/matlab/ref/barseriesproperties.html
This does not permit you to set the bar bases individually: for that you should consider patch() or fill()
0 个评论
A N
2018-2-3
1 个评论
Walter Roberson
2018-2-3
Any one bar() call that you make has to have the same BaseValue. You can make multiple bar() calls, or you could convert your bar() calls into calls to patch() or fill(), or you could make a series of calls to rectangle()
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Object Properties 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!