How can I move legend in app designer?

조회 수: 7 (최근 30일)
galaxy
galaxy 2022년 9월 22일
답변: Adam Danz 2022년 9월 27일
Hi all,
In GUI (figure), you know that I can keep left mouse and move legend.
figure(1);
p = uipanel('Position',[.1 .1 .8 .8]);
hSub = subplot(1,1,1, 'Parent', p);
t=0:.01:7;
plot(t,sin(t));
legend('sint t');
But in app designer, I can't.
Do anyone know why. Please tell to me how to fix.
Thank you
  댓글 수: 2
Adam Danz
Adam Danz 2022년 9월 26일
I have no problems dragging the legend in App Designer. If you upload your app file and provide clear, simple instructions on how to recreate the problem, we could dig deeper.
galaxy
galaxy 2022년 9월 26일
Thank you for your reply.
I uploaded my example app.
So, please tell me how to dragging the legend.
Thank you

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

답변 (2개)

Adam Danz
Adam Danz 2022년 9월 27일
The legend isn't draggable in your release (R2019b) but it is draggable starting in R2021a.

Eric Delgado
Eric Delgado 2022년 9월 22일
Hi @galaxy, just create a handle for your legend. See code attached made on R2021b (if you are working on a different release of Matlab, you have to open App Designer and save the file before run it).
% Option 1: create a handle to the legend (declare it as property of your app previously)
app.h = legend(app.UIAxes, 'sint t');
% Option 2: search it when you need it
h = findall(app.UIFigure, 'Type', 'Legend')
  댓글 수: 1
galaxy
galaxy 2022년 9월 24일
Thank you for your comment.
I understood your idea, but I want to click and keep left mouse and move legend.
anw, thank you so much.

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

카테고리

Help CenterFile Exchange에서 Legend에 대해 자세히 알아보기

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by