Plot Legends Related issues for many graphs

Hello, could you please help me in the following task:

I am producing a figure with many curves on it (I am using grid.arrange function). How do I make the legends for all those curves smaller so that it can fit the figure itself? this is the way it looks like and this is the code I am using for one particular plot:

I am generating PDF file with all of these plots, separately they look good, but when I use grid.arrange to have one figure with all of these plots, it looks like in that way.

This sort of thing?

Thank you for answering. To clarify, I want to have legends just like this as it is on this picture, but it always turns ca

On my graph (the first picture), it is always like two separate legend and seems like stretched

Hi!

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

Well, as I guess, you would like to have a look at the codes. This is what I am using

data <- data %>%
dplyr::mutate(date=lubridate::parse_date_time(date, "ymd"))

DailyDeaths <- (data$new_deaths/data$population)*100

PLOT2 <- data %>%
dplyr::mutate(seven_avg= ma(DailyDeaths, 7)) %>%
ggplot(aes(x=date, y=DailyDeaths)) +
geom_col(aes(x=date, y=DailyDeaths, fill="Daily New Deaths"))+
geom_line(aes(x=date, y = seven_avg, color = "7-days MA of New Deaths"),size = 1.5)+
labs(title="", x="", y="")+theme_classic()+scale_fill_manual(name = NULL, values = c("Daily New Deaths" = "#3f8dba")) +
scale_color_manual(name = NULL, values = c("7-days MA of New Deaths" = "red"))+theme(legend.position=c(0.005,0.83), legend.justification = c("left"),legend.key.width=unit(0.5, "lines"), legend.text=element_text(size=9),legend.box = "vertical",
axis.text.x = element_text(size = 9), axis.text.y = element_text(size =9),panel.border = element_rect(colour = "black", fill=NA, size=0.5))+expand_limits(y=c(-0.000, 0.0015))

Please include some data as well, or else the code you shared is guaranteed to fail, and not produce a representative example of the chart you wish to perfect. The guide I linked to covers that, and also gives you advice to format your post, to increase your chances of getting support.