Question about axes, control group and GUI (GUIDE)
Show older comments
Hello,
I have a few questions:
1. I have a GUI with several axes and plots. I would like to make a controul group with radio buttons to control which plots (and axes) are shown. So, I'll have two buttons and half of the axes will be shown at a time. When the user selects the other button, the axes that are displayed will disapear, and the other half will be displayed. When tha user selects another option on the control group, all the info on the axes should disapear, label, title, legend, axis ticks, etc.
2. I also have two buttons, left and right, to control which axes are being shown. This button must consider which set of axes are displayed (defined by the control group). I could make it work considering just one set of axes (ignoring the other half and also the control group).
3. As you can see in tha figure below, there's two axis ticks being shown. I don't know why that is.

4. To get the selected button I did this:
handles.conv = get(handles.show_conv.SelectedObject,'String');
if strcmp(handles.conv, 'Inversor')
....
elseif strcmp(handles.conv, 'Retificador')
....
end
5. Also, when the simulation (thet will get the variables to plot) is running all the plot appears baing plotted, and when the simulation stops only the one I set to be the top appears. I would like, if possible, to not show the plots when they are being plotted, only when I select them via the left and right button. If I could post a video, this would be easier to understand.
Another thing, what may cause an error that only happens the first time I run the program?
Any ideas?
Thanks!
9 Comments
Tommy
on 4 Jun 2020
What code are you using to hide axes which should be hidden?
You can tell plot() to make an invisible plot, e.g.
p = plot(axes_handle, X, Y, 'Visible', 'off');
Rik
on 4 Jun 2020
You could also actually use your own idea: create two axes and set the Visible property to on or off when appropriate.
Pedro Augusto de Castro e Castro
on 4 Jun 2020
Rik
on 4 Jun 2020
That looks difficult to handle. Do you have a reason for not putting those axes (or line?) handles in an array?
Tommy
on 4 Jun 2020
Note that plotting on a set of axes may reset all axes properties except for units and position (meaning, invisible axes will be made visible) depending on the value of the NextPlot property. You can use hold on to avoid this. But as far as I can tell, a plot will show even on invisible axes unless you make the plot invisible also:
ax = axes('Visible', 'off');
hold(ax, 'on') % so axes remain invisible after plotting
plot(ax, 1:10) % plot still shows
Rik
on 4 Jun 2020
You can put all handles that should be set to Visible in an array together. The set function will accept arrays of handles to mixed types, as long as all the properties you're trying to set exist in each object.
Pedro Augusto de Castro e Castro
on 4 Jun 2020
Rik
on 9 Jun 2020
Since it is not clear what exactly your edit of your question is: could you summarize the edit? What is the main remaining issue?
Pedro Augusto de Castro e Castro
on 10 Jun 2020
Edited: Pedro Augusto de Castro e Castro
on 10 Jun 2020
Answers (0)
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!