I have some data
set.seed(123)
df <- data.frame(rbind(
a = rnorm(4, 60, 30),
b = rnorm(4, 30, 15),
c = rnorm(4, 10, 5)))
spe_a = rnorm(3, mean=0.05, sd=0.003)
season = factor(c('Jan','Feb','Mar'))
colnames(df) <- c("spe_b","spe_c","spe_d","spec_e")
df <- cbind(season, spe_a, df)
# Yes I am sure there is a better method! Please advise in comments?
# I was determine to recreate my problem
Using the following I can produce a gridded plot:
plot_list = list()
library(ggplot2)
for(i in colnames(df[, 2:5])){
#
plot <- ggplot(data = df,
aes_string(x = df$season, y = i)) +
geom_bar(stat = 'identity',
fill = 'lightblue') + # For style
ggtitle(i) +
theme(axis.title.y = element_blank()) +
scale_y_continuous(expand = c(0,0))
#
plot_list[[i]] = plot
#
}
library(gridExtra)
grid.arrange(grobs = plot_list, ncol = 2)
Great! But its got a few issues (see fig. 2 also)
- I want the ticks (and labels) to always be at the top and bottom of the plot area.
- I want the ticks to have a consistent number of intervals (well at least somewhat 4/5)
- The plots need to have the same plot area.
I know there are a few questions in here but I think they may be related.
I did have a good look around


