How to stop the first plot from overwriting the second plot in app.Panel when using Tiledlayout? "Hold on" does not work.
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Bob Dole
el 6 de Mayo de 2024
Comentada: Matt J
el 6 de Mayo de 2024
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 comentarios
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre Annotations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!