Effacer les filtres
Effacer les filtres

How can I align an imagesc subplot with a line subplot?

3 vues (au cours des 30 derniers jours)
Yohan John
Yohan John le 11 Mai 2016
I am trying to align an image with a graph of the vertical sum of the image (a kind of image profile). But I cannot get the line plot's width to align with the imagesc of the plot above it. This is what I've tried:
A = randn(40);
sumA = sum(A)
h1 = subplot(211);
p1 = get(h1, 'pos');
imagesc(A), axis equal, axis off
h2 = subplot(212);
p2 = get(h2, 'pos');
p2(3) = p1(3);
set(h2, 'pos', p2);
plot(sumA)
The output is as shown in the image attached:
As you can see, the graph is much wider than the matrix shown by imagesc.

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by