bar() to a specific axes in GUI

1 Ansicht (letzte 30 Tage)
Obadah M.
Obadah M. am 18 Nov. 2018
Kommentiert: Rik am 22 Nov. 2018
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

Akzeptierte Antwort

Rik
Rik am 18 Nov. 2018
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 Kommentare
Obadah M.
Obadah M. am 22 Nov. 2018
Bearbeitet: Obadah M. am 22 Nov. 2018
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 am 22 Nov. 2018
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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Data Type Identification finden Sie in Help Center und File Exchange

Produkte


Version

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by