How can I align an imagesc subplot with a line subplot?
3 views (last 30 days)
Show older comments
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/164084/image.jpeg)
As you can see, the graph is much wider than the matrix shown by imagesc.
0 Comments
Answers (0)
See Also
Categories
Find more on Subplots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!