How do I plot on multiple graphs and have them update within a GUI?

3 次查看(过去 30 天)
I have two plots in a GUI (circleAxes, and lineAxes). On the circleAxes plot I have multiple data being plotted and updated, however, when I added the other plot in the GUI (lineAxes), only the last data is plotted on cicrleAxes. Is there a way to plot and update the data I want on cicrleAxes while also plot other data on lineAxes? This is the code that plots and updates the data for circleAxes. When I added lineAxes in GUIDE, the data I want does not plot.
theta = 0 : deg2rad(5) : (2 * pi);
pline_x = 3 * cos(theta) + 0;
pline_y = 3 * sin(theta) + 0;
x=-5:.25:-3;
x2 = 3:.25:5;
x3 = 0;
y=0;
a= round(round(-roll)-90); %change roll to accelerometer data
a_rad=((a*pi)./180);
[THETA,R] = cart2pol(x,y);
THETA=THETA+a_rad;
[xr,yr] = pol2cart(THETA,R);
a= round(round(-roll)-90.);
a_rad=((a*pi)./180);
[THETA2,R2] = cart2pol(x2,y);
THETA2=THETA2+a_rad;
[xr2,yr2] = pol2cart(THETA2,R2);
plot(handles.circleAxes, pline_x, pline_y, 'or',...
'MarkerFaceColor', 'r','MarkerSize', 4);
hold on
plot(handles.circleAxes,xr,yr-.25,'or','LineWidth', 2,'MarkerSize', 5);
plot(handles.circleAxes, xr2, yr2-.25, 'or', 'LineWidth', 2, 'MarkerSize', 5);
plot(handles.circleAxes,xr,yr+.25,'or','LineWidth', 2,'MarkerSize', 5);
plot(handles.circleAxes, xr2, yr2+.25, 'or', 'LineWidth', 2, 'MarkerSize', 5);
plot(handles.circleAxes, x3, y, 'sr', 'LineWidth', .5, 'MarkerSize', 10);
if(trigger == 1)
plot(handles.circleAxes, x3, y, 'sr', 'MarkerSize', 50);
end
axis equal
set(handles.circleAxes, 'XLim', [-5 5], 'YLim', [-5 5], 'XTick', [],...
'YTick', [],'Color', 'none','box', 'off', 'Visible', 'off');
hold off

回答(0 个)

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by