Plot points on saved figures in tiled layouts
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Zane Kincaid
le 23 Mar 2021
Commenté : Zane Kincaid
le 23 Mar 2021
I'm trying to create a plot with two figures of experimental data (loaded from .fig files) with my data scattered on the plots. The first plot works as expected (figure loads to tile and then points are correctly plotted over the figure, using the same axes as the loaded figure). When I try to plot onto the second figure/tile, new axes are created for my scattered points rather than using the axes from the loaded figure. How can I force my second scatter plot to use the same axis as the figure that is loaded to that tile?

%data from simulation
CD_12 = 0.073319041;
CL_12 = 0.44840455;
CD_5 = 0.017854421;
CL_5 = 0.4961008;
alpha = 12; %degrees
openfig('NACA0012_CD.fig'); %load saved figure
set(gcf,'Visible','off') %don't display figure on load
ax1=gca;
openfig('NACA0012_CL.fig');
set(gcf,'Visible','off')
ax2=gca;
figure()
hold on
tcl=tiledlayout(2,2); %create subplots
ax1.Parent=tcl;
ax1.Layout.Tile=1;
scatter(12, CD_12) %plot my data
hold on
scatter(5, CD_5)
nexttile
ax2.Parent=tcl;
ax2.Layout.Tile=2;
hold on
scatter(12, CL_12) %plot my data
hold on
scatter(5, CL_5)
0 commentaires
Réponse acceptée
Adam Danz
le 23 Mar 2021
>How can I force my second scatter plot to use the same axis
Specify the axis handle in the scatter function,
scatter(ax2, __)
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Axes Appearance dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!