How to update Axes LineStyle Order in Matlab Gui
Mostrar comentarios más antiguos
Dear Community,
I want to change the Linestyle of a Matlab Figure in a Gui. I have a popupmenu with a switch case structure where I can set the property. However, no change occurs whatsoever. I tried whats in commentary with refresdata and so forth, but no change. Do I need to replot all the data with plot (yet I dont know at all times which data I have. Or is there another way for it to update the figure?
Thanks a lot, below the code Ravi
switch get(hObject,'Value')
case 1
set(handles.axes_eis,'LineStyleOrder', '-');
guidata(hObject, handles);
% refreshdata(handles.axes_eis)
% refreshdata(handles.axes_eis,'caller')
% draw now
case 2
set(handles.axes_eis,'LineStyleOrder', '.-');
guidata(hObject, handles);
end
guidata(hObject, handles);
Respuesta aceptada
Más respuestas (1)
Geoff Hayes
el 17 de Oct. de 2015
Ravi - is the LineStyleOrder of the axes that you wish to change or the LineStyle of the curve plotted within the axes? I think that it may be the latter that you wish to change. If that is the case, then you will need to do something like the following in your popup menu callback
switch get(hObject,'Value')
case 1
set(handles.hPlot,'LineStyle', '-');
case 2
set(handles.hPlot,'LineStyle', '.-');
end
where handles.hPlot is the handle to the graphics object that was plotted using (for example) plot. The initialization of this field within handles may have occurred elsewhere in your code as
handles.hPlot = plot(...);
guidata(hObject,handles);
The first line is just the call to plot some data with the handle to the graphics object set in the hPlot field of handles. We then save this change to the updated handles object using guidata.
2 comentarios
Ravi Goyal
el 22 de Oct. de 2015
Editada: Ravi Goyal
el 22 de Oct. de 2015
Geoff Hayes
el 22 de Oct. de 2015
Ravi - you shouldn't create a function named plot since that conflicts with the built-in MATLAB function of the same name. What happens at the line of code
handles.hplot = plot(...);
Is plot the MATLAB function or yours? Please rename your function to something else and try again.
Categorías
Más información sobre Creating, Deleting, and Querying Graphics Objects en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!