Plot points on saved figures in tiled layouts

11 ビュー (過去 30 日間)
Zane Kincaid
Zane Kincaid 2021 年 3 月 23 日
コメント済み: Zane Kincaid 2021 年 3 月 23 日
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)

採用された回答

Adam Danz
Adam Danz 2021 年 3 月 23 日
>How can I force my second scatter plot to use the same axis
Specify the axis handle in the scatter function,
scatter(ax2, __)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAxes Appearance についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by