Using plot handle to replot a graph
61 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ethan Welch
el 13 de Ag. de 2022
Comentada: Les Beckham
el 13 de Ag. de 2022
In my project, I make an array of graphs. If one of the graphs is interesting, I would like to copy that graph with all of its formatting to a separate figure. I would like to do something like this. I know I could just replot everything, but a lot goes into each graph, and this seems like it should be possible.
x = 0:0.1:10;
y = [sin(x);cos(x);tan(x)];
for i = 1:3;
subplot(1,3,i)
p(i) = plot(x,y(i,:));
end
figure
plot(p(2))
0 comentarios
Respuesta aceptada
Les Beckham
el 13 de Ag. de 2022
Editada: Les Beckham
el 13 de Ag. de 2022
x = 0:0.1:10;
y = [sin(x);cos(x);tan(x)];
for i = 1:3;
a(i) = subplot(1,3,i);
p(i) = plot(x,y(i,:));
end
f = figure;
copyplot = copyobj(p(2), gca); % copy the plot from subplot 2 to the newly created axis in f
0 comentarios
Más respuestas (1)
Ethan Welch
el 13 de Ag. de 2022
Editada: Ethan Welch
el 13 de Ag. de 2022
2 comentarios
Les Beckham
el 13 de Ag. de 2022
Great. Exactly what I was going to suggest. That's how to learn: read the docs and experiment until you get the result that you want.
Ver también
Categorías
Más información sobre 2-D and 3-D Plots 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!