Is There a Way to Create a Sequence of Polar Plots in a Tiled Layout Using arrayfun with an Anonymous Function?
Sample data
s.th = pi/4:pi/4:2*pi;
s.r = [19 6 12 18 16 11 15 15];
s(2) = s(1); s(2).th = s(2).th*1.3;
If I want to make two plots in a tiled layout with Axes I can do this
figure
t = tiledlayout(1,2);
arrayfun(@(s) scatter(nexttile,s.th,s.r),s)
However, if I want to make polar scatter plots
figure
t = tiledlayout(1,2);
try
arrayfun(@(s) polarscatter(nexttile,s.th,s.r),s)
catch ME
ME.message
end
Right. nextile does not return a PolarAxes object.
But there doesn’t seem to be a way to force nexttile to create a PolarAxes nor can I find a function like a hypothetical nextpolar to use as the first argument to polarscatter.
Instead, as best I can tell a loop is required
figure
t = tiledlayout(1,2);
for ii = 1:2
h1 = nexttile;
polarscatter(s(ii).th,s(ii).r)
end
What’s interesting here is that nexttile creates an Axes and then deep in the bowels of polarscatter a PolarAxes is created based on some properties of that Axes, and then Axes is deleted
h1
Is there a way to create a sequence of polar plots in a tiled layout using arrayfun with an anonymous function?Sample data
s.th = pi/4:pi/4:2*pi;
s.r = [19 6 12 18 16 11 15 15];
s(2) = s(1); s(2).th = s(2).th*1.3;
If I want to make two plots in a tiled layout with Axes I can do this
figure
t = tiledlayout(1,2);
arrayfun(@(s) scatter(nexttile,s.th,s.r),s)
However, if I want to make polar scatter plots
figure
t = tiledlayout(1,2);
try
arrayfun(@(s) polarscatter(nexttile,s.th,s.r),s)
catch ME
ME.message
end
Right. nextile does not return a PolarAxes object.
But there doesn’t seem to be a way to force nexttile to create a PolarAxes nor can I find a function like a hypothetical nextpolar to use as the first argument to polarscatter.
Instead, as best I can tell a loop is required
figure
t = tiledlayout(1,2);
for ii = 1:2
h1 = nexttile;
polarscatter(s(ii).th,s(ii).r)
end
What’s interesting here is that nexttile creates an Axes and then deep in the bowels of polarscatter a PolarAxes is created based on some properties of that Axes, and then Axes is deleted
h1
Is there a way to create a sequence of polar plots in a tiled layout using arrayfun with an anonymous function? Sample data
s.th = pi/4:pi/4:2*pi;
s.r = [19 6 12 18 16 11 15 15];
s(2) = s(1); s(2).th = s(2).th*1.3;
If I want to make two plots in a tiled layout with Axes I can do this
figure
t = tiledlayout(1,2);
arrayfun(@(s) scatter(nexttile,s.th,s.r),s)
However, if I want to make polar scatter plots
figure
t = tiledlayout(1,2);
try
arrayfun(@(s) polarscatter(nexttile,s.th,s.r),s)
catch ME
ME.message
end
Right. nextile does not return a PolarAxes object.
But there doesn’t seem to be a way to force nexttile to create a PolarAxes nor can I find a function like a hypothetical nextpolar to use as the first argument to polarscatter.
Instead, as best I can tell a loop is required
figure
t = tiledlayout(1,2);
for ii = 1:2
h1 = nexttile;
polarscatter(s(ii).th,s(ii).r)
end
What’s interesting here is that nexttile creates an Axes and then deep in the bowels of polarscatter a PolarAxes is created based on some properties of that Axes, and then Axes is deleted
h1
Is there a way to create a sequence of polar plots in a tiled layout using arrayfun with an anonymous function? polar plot, arrayfun, tiled layout MATLAB Answers — New Questions









