필터 지우기
필터 지우기

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

조회 수: 4 (최근 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');

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interactive 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