How to Display in multiple axes text and images using UIPanel instead of figure ?
2 views (last 30 days)
Show older comments
Hi all !
I am looking for a way to plot multiples images and text in my app, i am using the code bellow to do so, it works just fine. However, the images and text are displayed on a figure, i want to do the same thing but on a UIpanel called in my app: app.ConverterSizingBenchmarkPanel
this is my code :
i am sure the problem occure in the first line with fh, but i am not sure how to do it .
Thank you for your precious answers
Lakhdar
fh = uipanel("Parent",app.ConverterSizingBenchmarkPanel); % << /!\ I THINK THE PROBLEM IS HERE /!\
axisPanelLeftUp = uipanel(fh, 'Position', [0 0.5 0.5 0.5], 'BackgroundColor', [1 1 1]);% Create a panel to hold the plot axis
leftUpAxis = axes(axisPanelLeftUp, 'Position', [0.1 0.1 0.8 0.8]); % Create a new axis on the panel
text(leftUpAxis,0, 1, sprintf('%.2f %s', 'Volume_x_Rth/Rth','L'), 'Fontsize',12,'FontWeight',"bold",'Color',[0.85 0.33 0.10])
set(axisPanelLeftUp,'handlevisibility','off', 'visible','on')
axisPanelLeftDown = uipanel(fh, 'Position', [0 0 0.5 0.5], 'BackgroundColor', [0 1 1]);% Create a panel to hold the plot axis
leftDownAxis = axes(axisPanelLeftDown, 'Position', [0.1 0.1 0.8 0.8]); % Create a new axis on the panel
text(leftDownAxis,0, 1, sprintf('%.2f %s', 'Volume_x_Rth/Rth','L'), 'Fontsize',12,'FontWeight',"bold",'Color',[0.85 0.33 0.10])
axisPanelRightUp = uipanel(fh, 'Position', [0.5 0.5 0.5 .5], 'BackgroundColor', [1 1 1]); % Create a different panel to hold the button and a second axis
rightUpAxis = axes(axisPanelRightUp,'Position', [0 0 1 1]); % Create an axis on the right panel
imshow("Amorphous_Inductor.jpg",'Parent',rightUpAxis');
axisPanelRightDown = uipanel(fh, 'Position', [0.5 0 0.5 .5], 'BackgroundColor', [1 1 1]);
rightDownBottomAxis = axes(axisPanelRightDown,'Position', [0 0 1 1]);% Create pushbuttons to plot data
imshow("Filtring_Capacitor.png",'Parent',rightDownBottomAxis');
0 Comments
Accepted Answer
Adam Danz
on 20 Sep 2020
Edited: Adam Danz
on 21 Sep 2020
fh should be your app's figure handle.
fh = app.UIFigure; % or whatever your fig handle is.
or perhaps you want to assign the parent-panel to the app in which case you still need to use the app's figure handle.
fh = uipanel("Parent",app.UIFigure; % or whatever your fig handle is.
but then you're missing other stuff like the panel's position property, etc.
8 Comments
More Answers (0)
See Also
Categories
Find more on Develop uifigure-Based Apps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!