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

1 Ansicht (letzte 30 Tage)
A N
A N am 2 Feb. 2018
Kommentiert: Walter Roberson am 3 Feb. 2018
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? ')

Antworten (2)

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

A N
A N am 3 Feb. 2018
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 Kommentar
Walter Roberson
Walter Roberson am 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()

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Data Exploration finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by