How to select specific figure and specific axes for plot?
Mostrar comentarios más antiguos
Hi,
i have a code running where you can open a figure (here: animation.fig), which has been pre-created with guide.
this figure contains static-text and 2 axes.
How can i select in which figure and in which axes of this figure i want to draw my plot??
I've been searching for a lot of time, but can't get it working.
I tried of course
figure(animation); % open figure and set to active
ax = findobj(animation, 'Type', 'Axes'); % get all axes in this figure (works! Here: axes2 and axes3)
axes(handles.axes2); <-- doesn't work: "Unrecognized field name "axes2"
Please help :-)
Respuestas (2)
Heiko
el 20 de Mzo. de 2023
1 voto
Antoni Garcia-Herreros
el 17 de Mzo. de 2023
Hello Heiko,
You could try something like this:
% Let's say your figure has been saves as a .fig file
animation=openfig('animation.fig');
NAxes=animation.Children;
a1=NAxes(1); % Chose your depending on where you want to plot your data (1 or 2)
hold(a1,'on') % If there is data already in the plot you may want to hold it
plot(YourData,'Parent',a1) % Plot data on ax1
I hope this helps!
Categorías
Más información sobre Creating, Deleting, and Querying Graphics Objects en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!