Is it possible to make graphs like this in MATLAB?
2 views (last 30 days)
Hello, I want to make a bar graph in matlab but the bars only showing for an interval in y for some x. For example. For example for x=1 I would like to create a bar that starts in y=3 and ends in y=5. For x=2 I would like to create a bar that starts from y=5 and ends in y=15.
Can you help me? Here's a picture to explain better what I'm looking for
Thanks In Advance,
Star Strider on 14 Nov 2014
Edited: Star Strider on 14 Nov 2014
The rectangle function can come to your rescue:
w = 0.5; % Rectangle Width
axis([0 4 0 20])
rectangle('Position',[1-w/2 1 0.5 4], 'LineWidth',2)
rectangle('Position',[2-w/2 5 0.5 10], 'LineWidth',2)
rectangle('Position',[3-w/2 10 0.5 5], 'LineWidth',2)