How to add only a fragment of bar to bar graph (not from 0)?

조회 수: 2 (최근 30일)
A N
A N 2018년 2월 2일
댓글: Walter Roberson 2018년 2월 3일
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? ')

답변 (2개)

Walter Roberson
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()

A N
A N 2018년 2월 3일
Thanks, it's almost working! But it is possible to set a interval of base values of bar graph from minimum to maximum? For example from 170 to 180 and the rest from 0 to 170 and from 180 to 200 as before? Should I set a vector with those two vales?
  댓글 수: 1
Walter Roberson
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 CenterFile Exchange에서 Discrete Data Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by