Problem: plot is displayed in the whole gui window instead of in the axes object.

1 次查看(过去 30 天)
I have a function that generates a mesh and plots it. I call this function from a push button object. The generated mesh is displayed in the whole gui window, covering it completely, making the gui useless. The only way I partially solved it, was by calling 'figure' before calling the function. The outcome really baffles me. The mesh is plotted in the axes object as expected and then a blank figure is prompted. Please could anyone help?

回答(1 个)

Morteza
Morteza 2015-8-25
编辑:Morteza 2015-8-25
it is not a suitable way in GUI programming. just make a handles.axes1 (Axis) in your GUI and whenever you want to plot something special just make this axis as your place that MATLAB plot data.
axes(handles.axes1);
plot('WHATEVER YOU WANT TO PLOT');
  4 个评论
Elisavet Chatzizyrli
The mesh function doesn't use the simple plot function for plotting. It would be simple enough to pass as a first argument the axes handle. For the trisurf function for instance, I did the thing with 'Parent' and then declaring the axes handle, but it still doesn't work. For some reason the mesh is plotted in the axis object, as intended, when I write figure before calling the mesh function from the button callback function, but then a blank figure is prompted as I said in my first post. When I simply declare axes(handles.axes1) in the first line of the code of the mesh generation function, without making any other change in the subsequent code, then an error message saying "Invalid object handle" is prompted when I push the button that calls the mesh generation function. I passed handles as an input in the mesh generation function, does it need something more?

请先登录,再进行评论。

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by