bar() to a specific axes in GUI

조회 수: 1 (최근 30일)
Obadah M.
Obadah M. 2018년 11월 18일
댓글: Rik 2018년 11월 22일
Hello,
I have 3 axes in my gui, and I'm trying to plot a bar graph on one of them. I have tried several solutions; however, I have had no luck.
I may have not applied the solution properly.
The answers above indicate that I should use: axes(handles.axes1); Though I'm not really sure which function I should place it in.
Any input is really appreciated

채택된 답변

Rik
Rik 2018년 11월 18일
You should always use explicit handles. You could indeed use the code you describe (which you would then need to put just before the call to bar).
But there is an easier solution: use explicit handles in your call to bar. If you read the doc, you see you have two options: specifying the axes as the first argument, or using the Name-Value pair to specify the parent axes.
  댓글 수: 24
Obadah M.
Obadah M. 2018년 11월 22일
편집: Obadah M. 2018년 11월 22일
Okay thank you Rik!
You have posted an improved version of the function I posted, however; I would still like to know what is causing this "bug". The whole area from 0 to -40 is red, is it another bar?
x = [0 0.5 1];
y = [0 cels 0];
bar (x, y, 'r', 'BaseValue', -40, 'LineWidth', 0.7)
set(gca, 'xtick', [], 'ytick', [])
axis([0 1 -40 120]);
Rik
Rik 2018년 11월 22일
With the base value you indicate what should be the lower value of your bar plot. Then you choose to plot 3 bars, so you get 3 red stacks. I have already showed you what I would use as code, so I'm not going to look into big parts of your code.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Identification에 대해 자세히 알아보기

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by