Multiple plots using same axis in Matlab

조회 수: 5 (최근 30일)
akshay raj
akshay raj 2015년 2월 2일
편집: per isakson 2015년 2월 2일
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