How to stop the first plot from overwriting the second plot in app.Panel when using Tiledlayout? "Hold on" does not work.
조회 수: 6 (최근 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에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!