How to Display in multiple axes text and images using UIPanel instead of figure ?
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Adam Danz
2020-9-20
编辑:Adam Danz
2020-9-21
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Develop uifigure-Based Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!