Multiple plots using same axis in Matlab

2 次查看(过去 30 天)
I have a pop-up menu (used GUIDE to create it.) which calls 3 functions
  1. first function gives out a scatter plot of 14x14x14
  2. second function plots a bar graph of 4x1 (dynamic data)
  3. third function plots an Mx14 (dynamic data)
the thing all these use the same axes
axes(handles.someName).
I tried putting axes focus on every switch statement
function plot_options_popup_Callback(hObject, eventdata, handles)
str = get(hObject, 'String');
val = get(hObject, 'Value');
switch str{val};
case 'Final Reading'
YesNo = evalin('base','exist(''eeg_output_1d'',''var'')');
axes(handles.eeg_final)
if(YesNo == 1)
plot(evalin('base','eeg_output_1d'));
else
return;
end
case 'Activation Plot'
axes(handles.eeg_final)
activation
case 'Emotion State'
axes(handles.eeg_final)
emo_Callback
end
And when I change the option to a new one, the focus changes to the dynamic data which is continuously plotting.
Is there any way I could ask to GUI to stick to the thing what I want to and plot the dynamic data in the background?
Thanks in advance.

回答(1 个)

per isakson
per isakson 2015-2-2
编辑:per isakson 2015-2-2
Yes, provide the axes-handle in the call to scatter3 ... instead of setting the current axes. Doc says:
scatter3(ax,___) plots into the axes specified by ax instead of into the
current axes (gca). The ax option can precede any of the input argument
combinations in the previous syntaxes.
and
plot(ax,___) plots into the axes specified by ax instead of into
the current axes (gca). The option, ax can precede any of the input
combinations in the previous syntaxes.
and
bar(ax,___) plots into the axes specified by ax instead of into the
current axes (gca). The option ax can precede any of the input
argument combinations in the previous syntaxes.
  2 个评论
akshay raj
akshay raj 2015-2-2
but then they are continuous data wouldn't that change its focus from one function to other?
per isakson
per isakson 2015-2-2
编辑:per isakson 2015-2-2
Not sure I understand or rather I don't understand. Axes-handles are unique in a Matlab session. Make an experiment!

请先登录,再进行评论。

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by