Is it possible to make graphs like this in MATLAB?

조회 수: 2 (최근 30일)
Rui
Rui 2014년 11월 14일
댓글: Star Strider 2014년 11월 14일
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
Star Strider 2014년 11월 14일
편집: Star Strider 2014년 11월 14일
The rectangle function can come to your rescue:
w = 0.5; % Rectangle Width
figure(1)
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)
produces:
  댓글 수: 6
Rui
Rui 2014년 11월 14일
Thank you so much! You helped me a lot!
Best Regards
Star Strider
Star Strider 2014년 11월 14일
My pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Evan
Evan 2014년 11월 14일

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by