Create Polar Axes in Tiled layout

I am trying to include a polar axes into a tiledlayout, and change some stuff to the axes. Unfortunately I am not able to include a polaraxes into my tile. The second plot is supposed to be in the tile below.
t = tiledlayout(2,1);
nexttile;
plot(rand(10),rand(10))
nexttile;
plax = polaraxes();
plax.RDir = 'reverse';
polarplot(plax, rand(10),rand(10));

 Accepted Answer

The trick is to set the location of the polaraxes manually. Not nice but it works.
t = tiledlayout(2,1);
nexttile;
plot(rand(10),rand(10))
plax = polaraxes(t);
plax. Layout.Tile = 2; % tile location
plax.RLim = [0;2];
plax.RDir = 'reverse';
hold on
polarplot(plax, rand(10),rand(10));

3 Comments

You can set the TileSpan same as the Location
t = tiledlayout(2,2);
nexttile;
plot(rand(10),rand(10))
plax = polaraxes(t);
plax. Layout.Tile = 2; % tile location
plax.Layout.TileSpan = [2 1];
plax.RLim = [0;2];
plax.RDir = 'reverse';
hold on
polarplot(plax, rand(10),rand(10));
When I do this, it creates a double axis on each tile. One has the polar plot, the other is just a regular blank axis:
tlo = tiledlayout(4,2);
for is = 1:8
nexttile;
ax = polaraxes(tlo);
ax.Layout.Tile = is;
polarplot(rand(10,1),rand(10,1),'.');
end
Result:
Any help is appreciated.
It's because you already create a axis with the nexttile command. Just don't use it and you're good to go
tlo = tiledlayout(4,2);
for is = 1:8
% nexttile;
ax = polaraxes(tlo);
ax.Layout.Tile = is;
polarplot(rand(10,1),rand(10,1),'.');
end

Sign in to comment.

More Answers (0)

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Products

Release

R2022b

Asked:

on 3 Jan 2023

Commented:

on 9 Aug 2023

Community Treasure Hunt

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

Start Hunting!