How to add only a fragment of bar to bar graph (not from 0)?
1 view (last 30 days)
Show older comments
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 Comments
Answers (2)
Walter Roberson
on 2 Feb 2018
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 Comments
A N
on 3 Feb 2018
1 Comment
Walter Roberson
on 3 Feb 2018
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()
See Also
Categories
Find more on Data Exploration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!