Effacer les filtres
Effacer les filtres

How to affix a horizontal subplot below a regular plot?

1 vue (au cours des 30 derniers jours)
A R
A R le 27 Juin 2021
Commenté : A R le 27 Juin 2021
Summary is it. I want to have a regular plot directly above a subplot (horizontal, about half the vertical size of the top plot).

Réponse acceptée

Image Analyst
Image Analyst le 27 Juin 2021
Modifié(e) : Image Analyst le 27 Juin 2021
Do you mean like this:
subplot(3, 1, 1:2);
plot(rand(10, 1), 'b.-', 'LineWidth', 2);
grid on;
subplot(3, 1, 3);
plot(rand(10, 1), 'b.-', 'LineWidth', 2);
grid on;
Just use the top 2 plots in a 3x1 grid to do one plot, then the final last plot in the bottom row to do your other plot.
  2 commentaires
Image Analyst
Image Analyst le 27 Juin 2021
You can even combine different kinds of subplots, like:
% Plot in upper two lanes
subplot(3, 1, 1:2);
plot(rand(10, 1), 'b.-', 'LineWidth', 2);
grid on;
% Plot in lower left
subplot(3, 3, 7);
plot(rand(10, 1), 'b.-', 'LineWidth', 2);
grid on;
% Plot in lower right two panels.
subplot(3, 3, 8:9);
plot(rand(10, 1), 'b.-', 'LineWidth', 2);
grid on;
A R
A R le 27 Juin 2021
Thanks so much! The colon syntax never occurred to me.

Connectez-vous pour commenter.

Plus de réponses (1)

Chunru
Chunru le 27 Juin 2021
subplot(3,1,1:2); plot(rand(10,1))
subplot(3,1,3); plot(rand(10,1));

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by