How to Display in multiple axes text and images using UIPanel instead of figure ?

6 ビュー (過去 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');

採用された回答

Adam Danz
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 件のコメント
Khalala Mamouri
Khalala Mamouri 2020 年 9 月 21 日
Sorry to confuse you. YES ! it work perfectly, What happens is that i was creating new UIPanelon top of the already existing one.
OK so let me share my code for the next user :
leftUpAxis = axes(app.ConverterSizingBenchmarkPanel, 'Position', [0 0.5 0.5 0.5]); % Create a new axis on the panel
leftUpAxis.XColor='none'; % HIdes the axes because later i will show text here
leftUpAxis.YColor='none'; % Hides the axes because later i will show text here
Police = 9; %
%% Writing text (exemple)
text(leftUpAxis,0, 1, sprintf(' %s ', 'Inductor Benchmark'), 'Fontsize',Police,'FontWeight',"bold",'Color',[0.0 0.45 0.74])
%% show an image (exemple2)
rightDownBottomAxis = axes(app.ConverterSizingBenchmarkPanel,'Position', [0.5 0 0.5 .5]);% Create pushbuttons to plot data
imshow("Filtring_Capacitor.png",'Parent',rightDownBottomAxis');
Adam Danz
Adam Danz 2020 年 9 月 21 日
Glad we got to the bottom of it!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by