"Manually" adjusting the position of tiles in a tiled layout using Property Inspector

92 vues (au cours des 30 derniers jours)
All:
Thank you for reading this. My goal is to adjust the position of tiles in a tiled layout to match a particular layout that I have in mind. Let's say I have the following:
f1 = @(x) x^2;
f2 = @(x) sin(x);
f3 = @(x) tan(x);
x1 = -100;
x2 = 100;
tiledlayout('flow');
nexttile
fplot(f1, [x1 x2]);
nexttile
fplot(f2, [x1 x2]);
nexttile
fplot(f3, [x1 x2])
After running this code (and getting a tiled figure), I then go to the Property Inspector. I see the following:
I then go to the first Axes (or any of tha axes) and see the following:
However, I can't change any of the position parameters.
What should I do? Additionally, is there a "better" way of customizing the tile positions in a tiled layout?
Thank you.

Réponses (1)

Chris
Chris le 16 Nov 2022
Modifié(e) : Chris le 16 Nov 2022
If you have something simple in mind, it's likely you can do so without manually adjusting things:
figure('Color',[.8,.8,.8]) % The default figure color I see is white, which can be confusing
tiledlayout(2,4)
nexttile
nexttile(3,[2,2]) % Skip a tile, start on 3
nexttile([1,2]) % Next available, 2 tiles wide
Setting "flow" gives Matlab the go-ahead to reposition things as necessary, so that's definitely not what you want.
If you want complete control, just place the axes directly.
f = figure('Color',[.8,.8,.8]);
ax1 = axes(f,'Units','Normalized','Position',[0.1 0.1 0.3 0.3]);
ax2 = axes(f,'Units','Normalized','Position',[0.7 0.7 0.2 0.2]);
You can view the properties of each graphics object programmatically, without needing Property inspector.
ax1
ax1 =
Axes with properties: XLim: [0 1] YLim: [0 1] XScale: 'linear' YScale: 'linear' GridLineStyle: '-' Position: [0.1000 0.1000 0.3000 0.3000] Units: 'normalized' Show all properties
plot(ax1,1:10)
There are many properties, of which "Position" is present for figures and axes.
ln = ax1.Children
ln =
Line with properties: Color: [0 0.4470 0.7410] LineStyle: '-' LineWidth: 0.5000 Marker: 'none' MarkerSize: 6 MarkerFaceColor: 'none' XData: [1 2 3 4 5 6 7 8 9 10] YData: [1 2 3 4 5 6 7 8 9 10] Show all properties

Catégories

En savoir plus sur Specifying Target for Graphics Output dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by