How to stop the first plot from overwriting the second plot in app.Panel when using Tiledlayout? "Hold on" does not work.
24 次查看(过去 30 天)
显示 更早的评论
The below is my code, it should plot 5 graphs in one figure using the tiledlayout function. Each graph should have a red line and blue circles. If I run the below, without the app.Panel portion in the command line, I get the expected graph. However, when add in app.Panel so the plot shows up in my matlab app, I only get the second plot with the red line, the first plot with the blue circles is gone.
Anyone know a solution to this? Thanks!
x=1:1:10;
y=2:2:20;
x_values=1:3:30;
y_values=1:2:20;
t=tiledlayout(app.Panel,1,5);
for c=1:5
ax=nexttile(t);
plot(ax,x,y,'o', 'MarkerSize', 10, 'LineWidth', 2 ,'color','b');
hold on;
plot(ax, x_values, y_values, 'r', 'LineWidth', 2);
title(ax,'test');
xlabel(ax,'Setting Value'); % Add title for X axis
ylabel(ax,'Test Factor'); % Add title for Y axis
hold off;
end
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!