Subplot according to Real size
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MSP
le 10 Mar 2019
Réponse apportée : Cris LaPierre
le 10 Mar 2019
Greeetings people,
I am having an issue regarding plotting according to the real size.I am trying to explain according to this code .What I want is use subplot to plot according to the real size, which is like the 'b' should have 10 times the size of 'a' vertically and 2 times of 'a' horizontally.
Thanks in advance
a=rand(60,120)
b=rand(600,240)
figure
subplot 121
imagesc(a)
axis equal
axis([0 60 0 120])
subplot 122
imagesc(b)
0 commentaires
Réponse acceptée
Cris LaPierre
le 10 Mar 2019
There is no good way to do what you want with subplot. Even if you merge multiple plots, there is no control over the size. You probably need to create the axes manually to have fine control over their size. Here's how I might do it.
a=rand(60,120)
b=rand(600,240)
% Create a figure window and set the units to normalized (0=bottom/left, 1=right/top)
h=figure('Units','normalized')
% Divide the figure window into a grid.
% Plot(a) will be between x(2) and x(3), y(11) and y(12)
% Plot(b) will be between x(4) and x(6) - it's twice as wide, y(2) and y(12)
xPos = linspace(0,1,7);
yPos = linspace(0,1,13);
% Place first axis
ax1 = axes('Position',[xPos(2) yPos(11) xPos(2) yPos(2)])
imagesc(ax1,a)
axis equal
axis tight
% Place second axis
ax2 = axes('Position',[xPos(4) yPos(2) xPos(3) yPos(11)])
imagesc(ax2,b)
axis equal
axis tight
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!