I'm trying to have my bottom graphs have widths proportional to the length of the month.
However, I end up with

I have 2 levels of graphs, 1 with a larger plot that takes an entire row and another with 12 plots that take up the entire 2nd row.
For the 2nd row plots, I wish to have their widths proportional to the length of the month so I do
layout(matrix(c(rep(1,12),2:13),nrow=2,byrow=T),widths=c(1,months))
months
[1] 31 28 31 30 31 30 31 31 30 31 30 31
The odd thing is when I manually adjust the numbers in the widths array ( using 1s and 2s). The sizes do fluctuate accordingly. However, in this case. This appears to not be the case.
January is much too short. Am I missing something in my logic?
You have only 12 plots on the bottom line but you provided 13 values for the widths= argument (number 1 plus all months values). Just use widths=months to get the result you need. Number of values you provided with the widths= argument should be equal to the number of plots in one longest row but not to the number of all plots.
months<-c( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
layout(matrix(c(rep(1,12),2:13),nrow=2,byrow=T),widths=months)
layout.show(n = 13)

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With