I am building plot using ggplot2 and trelliscope packages in R:
Sample data:
name=letters[1:26]
avg_rating=sample(1:10,26, replace=TRUE)
position <- toupper(name[sample(1:9, size = 26, replace=TRUE)])
club <- "inter"
df=data.frame(name, avg_rating, position, club)
Plot:
plot1 <- ggplot(data1, aes(x=name, y=avg, fill=pos))+
geom_bar(stat="identity")+
theme(legend.position = "right")+
ylim(-5,10)+
coord_polar(start=0)+
facet_trelliscope(~club, nrow = 4, ncol = 5, scales = "free_x")
Problem is the trelliscope facet only allows me to either include legend to all the subplots (as with the code above) or not include at all (legend.position = "null")
.
I would like to include only one legend for all the subplots as it is the same for all of them and I can save a lot of space.
Is there a way to do this?