Strange display of 2D axes within panel in new MATLAB version

7 次查看(过去 30 天)
I'm upgrading from R2017b to R2024a and I'm experiencing strange results in 2D plotting in the new version. See below for examples of the strange results. I'll provide some information about the code and include some of my observations. I'm hoping someone will recognize what is happening here and know of a solution for it.
I'm making use of the GUI Layout Toolbox. I created two uipanel objects, one for 2D and one for 3D plots, that are children of a uix.VBox object. Each uipanel has only an axes object as child. At any given time, either a 2D or a 3D plot is displayed. To switch from a 3D to a 2D plot, I remove the parent of the 3D uipanel and set the vbox as parent of the 2D uipanel. When plotting something new, I first reset the axes handle and delete its children.
Unfortunately I cannot make a MWE. I tried, but I don't get the strange results. The cause might therefore be due to the complex implementation of surrounding code, which I cannot fully describe or incorporate in a MWE. However, if you need more specific information, just ask and I can relay my observations.
My observations are the following:
  • As soon as I interact with the plot, such as zooming or panning, the plot is updated and properly displayed.
  • The result is consistent for the same content, i.e. if I display a simple sine for a specific interval, I get the same strange result every time. If I change to a cosine, or change the interval, I get a different result.
  • If I do not do the unparenting/reparenting of the uipanels every time, I do not get a strange result. However, I'd like to keep this because the behaviour is nice, or at least it used to be.
  • The resetting of the axes handle also seems to play a role. If I place a debugger at the resetting, I see that the plot is as expected, then if I do a step (the resetting) then the plot is messed up, but in a different way than without debugging. I included an example of this as the last image.
After resetting an axes:
  4 个评论
Steven H
Steven H 2024-5-24
Hi @Noah, I appreciate your suggestion but it's not really what I'm looking for. The end user should not be able to decide when to plot 2D or 3D, because it depends on which node is selected in a tree. This should update the plot automatically.
Matlab Pro
Matlab Pro 2024-5-24
A short sample code will help me aiding you to find the answer..
Implementation can be Tabs, Treeview..
I understand that in your implementation of the tree (using treeview?) the type of nodes contols which type of plot will be shown. Correct?
Anyhow - lets divide the "flow" into 2 parts;
  1. Graph type selection - the selection can be by selecting a Tab (from a group of tabs) or selecting a treenode.
  2. Graph drawing of data on axes
Your problem is on bullet 2. SO the problem is Axes rendering issue. - correct.?
  • Please send code samples
  • what MWE stands for?

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graphics Object Programming 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by