Subplot n pcolor matrixes

Hello everyone,
I have to subplot n pcolor matrixes in a 1 x n figure, but I have several problems because I can't set the size of the matrixes in the subplot. All my matrixes have the same size (120 x 120) and I must do it without using the image() function.
Please, could you help me?
Thank you so much.

 Accepted Answer

Image Analyst
Image Analyst on 21 Sep 2015
Then use imshow(). It's now in base MATLAB and doesn't chop off the last row and last column like pcolor() does.

3 Comments

Sorry but I am working with tumor images and I need to see with precision where the metabolic activity is concentrated and compare the different images.
This is the result with the pcolor ():
And this is with the imshow():
As you can see, there are a lot of differences between using pcolor() and imshow(), but I am still having problems with the subplot...
Jose: You have floatingpoint data so you need to use the [] option with imshow: imshow(data, []). Now your data will show all the gray levels. Otherwise it expects that all floating point data goes between 0 and 1 and anything more than 1 gets clipped to 1, which it displays as pure white.
Try this code:
subplot(1, 2, 1);
data = 300*rand(4,3);
imshow(data, []);
title('4x3 with imshow', 'FontSize', 25);
subplot(1, 2, 2);
pcolor(data);
title('4x3 with pcolor shows as 3x2', 'FontSize', 25);
Now, how many of the 4 rows appear when you call pcolor? How many of the columns appear when you call pcolor? And how many show up with imshow()?
What do you notice about the aspect ratio of the two methods? Which one displays elements as squares, and which one doesn't?
Yes, I have been thinking about what you said me and I think you are right, the imshow([]) method is much more effective. I have done my subplot with the imageshow(data,[]) function and I will show it to my superiors; I think they will like it.
Thank you so much one more time.

Sign in to comment.

More Answers (1)

n = length(AllMatrices);
for K = 1 : n
this_ax = subplot(1,n,K);
this_matrix = AllMatrices{K};
pcolor(this_ax, this_matrix);
title(sprintf('Matrix #%d', K));
end

3 Comments

I have done this but I still have problems. This is my result:
We have to consider, that I save the number of my "first and last" images first, and then I create all of them in each loop iteration, so I have done a few modifications (in this example, First is 73 and Last is 81):
n=Last-First+1;
for K = First:Last
...
% Creation of Matrix "Activity" (120 x 120)
...
this_ax = subplot(1,n,K-First+1);
this_matrix = Activity;
pcolor(this_ax, this_matrix);
title(sprintf('Matrix #%d', K));
end
Do you know where is the problem?
After the pcolor call, add
axis equal
But most of the problem is from trying to crowd too much information in. You should consider using montage()
Yes, it worked and it really taught me a lot too, but I am sorry can only choose one answer.
Thank you so much anyway, Walter.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!