I have a figure that I am doing a lot of programtic manipulation to and after all of the code has executed, some of the elements either aren't visible, or the sizes are all wrong. However, if I simply grab the endge of the window and just slightly resize the figure, everything is refreshed and looks normal.
Before someone says "drawnow", I have tried "drawnow" in multiple locations. It seems like I need to flag the figure as dirty and then call "drawnow", but I haven't figured out a way to do that.

댓글 수: 2

Askic V
Askic V 2023년 1월 18일
Did you check refreshdata from the documentation?
https://www.mathworks.com/help/matlab/creating_plots/making-graphs-responsive-with-data-linking.html
Matt Butts
Matt Butts 2023년 1월 18일
This is not related to data within a plot. It is mainly affecting plot labels and other UI components that have been also added to the figure.

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

 채택된 답변

Image Analyst
Image Analyst 2023년 1월 18일

0 개 추천

drawnow should work. Maybe it's some quirk of your video adapter. Have you tried the same program on someone else's computer? Or maybe on your second monitor, if you have one? We could try it if you upload your data and code.

댓글 수: 3

Matt Butts
Matt Butts 2023년 1월 18일
I have tried it on multiple machines with various display settings.
The code that creates the issue utilizes a dozen classes or so (it's part of a larger app) and so it would be difficult for me to share an example.
It feels like the drawnow flushes all graphics commands, but I need a way for the figure to genereate new items in the queue to be refreshed.
You should call tech support, because drawnow should immediately repaint/refresh the current figure. Are you sure you didn't switch to a different figure right before you called drawnow.
drawnow has some options, like nocallbacks, so you might experiment with those.
drawnow nocallbacks
Matt Butts
Matt Butts 2023년 1월 18일
Thanks for the suggestions. Knowing this, I dug more into it and boy do I feel stupid now... The components that were not showing up had their height set to 0 and I had a size changed callback that adjusted this to the correct size hence why they would show up after a window size change.
Thanks for taking the time to answer though.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Graphics Performance에 대해 자세히 알아보기

제품

릴리스

R2022a

질문:

2023년 1월 18일

댓글:

2023년 1월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by