Sizing in subplot()
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
GCats
am 28 Mai 2020
Beantwortet: Fangjun Jiang
am 28 Mai 2020
Hi!
I'm plotting 6 graphs using the subplot() command. I'd like 3 rows and 2 columns, however all the graphs are squeezed at the top and i'm not sure how to shape them so that they are nice and readable.
Here's how i'm plotting it:
% Plotting finite difference gradients
figure(1)
subplot(821)
semilogx(hx,dfdx1)
xlabel('Difference step hx'), ylabel('df/dx1'), title('Spring mass')
subplot(822)
semilogx(hx,dfdx2)
xlabel('Difference step hx'), ylabel('df/dx2'), title('Spring mass')
%plotting of constrainst g(1)
subplot(823)
semilogx(hx,dgdx1(:,1)')
xlabel('Difference step hx'), ylabel('dg1/dx1'), title('Length constraint')
subplot(824)
semilogx(hx,dgdx2(:,1)')
xlabel('Difference step hx'), ylabel('dg1/dx2'), title('Length constraint')
%plotting on constraint g(4)
subplot(825)
semilogx(hx,dgdx1(:,4)')
xlabel('Difference step hx'), ylabel('dg1/dx1'), title('Shear Stress constraint')
subplot(826)
semilogx(hx,dgdx2(:,4)')
xlabel('Difference step hx'), ylabel('dg1/dx2'), title('Shear Stress constraint')
%plotting on constraint g(5)
subplot(827)
semilogx(hx,dgdx1(:,5)')
xlabel('Difference step hx'), ylabel('dg1/dx1'), title('Frequency constraint')
subplot(828)
semilogx(hx,dgdx2(:,5)')
xlabel('Difference step hx'), ylabel('dg1/dx2'), title('Frequency constraint')
Attached the photo of the plots. Thank you in advance for your help!
0 Kommentare
Akzeptierte Antwort
Fangjun Jiang
am 28 Mai 2020
subplot(3,2,x) gives you 3 rows and 2 columns thus 6 subplots. x can be 1,2,...6
0 Kommentare
Weitere Antworten (1)
madhan ravi
am 28 Mai 2020
Plot first 4 graphs in a separate figure and the next four in the other.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Subplots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!