This is my first post, so I apologise if I've missed something. I'm making a plot using ggplot on R. I would like the units of "log FMRm" to be on a new line in the legend title. How can I get around this?
ggplot(data = cf_joint2, aes(j_df.d13C_VPDB, j_df.d15N_Air)) +
geom_point(aes(shape= groupmass, color = j_df.log_mass_scaled), size= 1.5) +
labs(x=(expression(paste(delta^{13}, "C (\u2030)"))),
y=(expression(paste(delta^{15}, "N (\u2030)"))),
colour= expression(paste("log FMR"[m]~"\n(mg"~O[2]~kg^-1~hr^-1*")")),
shape="log Mass (kg)") +
theme(text = element_text(size=15)) +
scale_colour_viridis_c()+
scale_shape_manual(values=c(16,17,15,18))+
stat_ellipse(level=0.99) +
facet_wrap(~factor(j_df.Common_name))
I've tried using \n, but am not getting the right results. I had a go at using atop(), but it made the text lower but not left-aligned.
ggplot(data = cf_joint2, aes(j_df.d13C_VPDB, j_df.d15N_Air)) +
geom_point(aes(shape= groupmass, color = j_df.log_mass_scaled), size= 1.5) +
labs(x=(expression(paste(delta^{13}, "C (\u2030)"))),
y=(expression(paste(delta^{15}, "N (\u2030)"))),
colour= expression(paste(atop("log FMR"[m]), "(mg"~O[2]~kg^-1~hr^-1*")"), hjust =0 ),
shape="log Mass (kg)") +
theme(text = element_text(size=15)) +
scale_colour_viridis_c()+
scale_shape_manual(values=c(16,17,15,18))+
stat_ellipse(level=0.99) +
facet_wrap(~factor(j_df.Common_name))