Subplot ID in a loop where k> number of plot locations for a single page
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hi, This is a tricky one for me to explain. I have q files, and want to subplot them on a page with 4 locations. Due to considerations for how the figures/pages will be looked at in a pdf I am using a (2,4,q) subplot and plotting a distribution in (2,2,1:2) etc. It would be easier to just have (2,2,q) but they would not look so good in the final pdf.
For q being no higher than 4 I use
subplot(PlotsPerPage/2,PlotsPerPage,[q+q-1, q+q])
which works nicely. But when q>4 it falls over. I think my problem is more of a math issue than matlab but I am hoping that there will be a way to do take use of a matlab function maybe in a way I am not aware of. I can do this longhand by having if statements for when q=5:8 or q=9:12 etc but would like to avoid that as I can see q going to a very high number by the end of the year.
2 Commenti
Jan
il 10 Apr 2017
I'm confused by the question. What does "using a (2,4,q) subplot and plotting a distribution in (2,2,1:2) etc." mean? Do you really mean "subplot(PlotsPerPage/2,PlotsPerPage, [q+q-1, q+q])"? Then the pages contains more plots then PlotsPerPage and for q = 2 you get the position [3, 4]. Sorry, I cannot follow you.
You currently have:
subplot(2,4,q)
What fails for q > 4? Do you want to display 8 diagrams per page? What happens and what do you want to happen?
Risposta accettata
Jan
il 10 Apr 2017
Do you mean:
q = 1:10
qq = mod(q - 1, 4) + 1
>> 1 2 3 4 1 2 3 4 1 2
Then the values of qq are restricted to 1:4. I assume you have to open a new figure when qq is 1 - as shown in your other thread.
3 Commenti
Jan
il 11 Apr 2017
If "subplot(PlotsPerPage/2,PlotsPerPage,[q+q-1, q+q])" works reliably, then use in the 2nd loop:
for q = 5:8
qq = mod(q - 1, 4) + 1;
subplot(PlotsPerPage/2,PlotsPerPage,[qq+qq-1, qq+qq])
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Subplots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!