Thread Subject: subplot transpose

Subject: subplot transpose

From: Juliette Salexa

Date: 9 Jul, 2009 18:30:19

Message: 1 of 3

for i=1:25
    subplot(5,5,i);
    differences=rand(1,6) ; bar(differences); title(i);
end

If you run that code above you'll notice that the numbers run from top left corner, to the right, and then down to the next row and to the right again.

If want them running from top left corner DOWN to the to bottom left, then up to the first row of the next column again.

Basically I want the transpose of the digram that is generated by the code above.

Is there a way ??

Thanks
xoxo

Subject: subplot transpose

From: Shanmugam Kannappan

Date: 9 Jul, 2009 19:16:02

Message: 2 of 3

"Juliette Salexa" <juliette.physicist@gmail.com> wrote in message <h35cvr$63s$1@fred.mathworks.com>...
> for i=1:25
> subplot(5,5,i);
> differences=rand(1,6) ; bar(differences); title(i);
> end
>
> If you run that code above you'll notice that the numbers run from top left corner, to the right, and then down to the next row and to the right again.
>
> If want them running from top left corner DOWN to the to bottom left, then up to the first row of the next column again.
>
> Basically I want the transpose of the digram that is generated by the code above.
>
> Is there a way ??
>
> Thanks
> xoxo

Hi,

By default subplot works in row wise but if you need to have in column wise
You can do this way.....
idx = reshape(1:25,5,[])'
idx=idx(:);
for i=1:25
    subplot(5,5,idx(i));
    differences=rand(1,6) ; bar(differences); title(i);
end

Hope this helps .....

Shan......

Subject: subplot transpose

From: Juliette Salexa

Date: 9 Jul, 2009 19:45:03

Message: 3 of 3

PERFECT! Thanks Shan!

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
subplot transpose Sprinceana 9 Jul, 2009 16:56:11
rssFeed for this Thread

Contact us at files@mathworks.com