0
AvsCa <- read.csv("AvsCa.csv")
ggplot(data = AvsCa, aes(x = Ca, y = A, group = Light_Level, color = Light_Level))+
  geom_point()+
  geom_line()+
  labs(y=expression("CO"["2"]*~"Assimilation Rate"~italic(A)~"(µmol"~~m^-2*s^-1*")"), x=expression("Ambient CO"["2"]*~"Concentration, C"["a"]*~"(µmol mol"^-1*")"))+
  scale_y_continuous(sec.axis=dup_axis())+
  theme_set(theme_bw())+
  theme(axis.ticks.length=unit(-0.1, "cm"), axis.text.x.top=element_blank(), axis.text.y.right=element_blank(), axis.title.x.top=element_blank(), axis.title.y.right=element_blank(), panel.grid.major = element_blank(), panel.grid.minor = element_blank(), legend.position = c(.2,.8))+
  scale_color_discrete(name="Qin (Light Intensity)", labels=c(expression("1000 µmol m"^-2*s^-1),expression("1500 µmol m"^-2*s^-1)))

I tried adding theme(axis.title.y = element_text(margin = margin(t = 0, r = 20, b = 0, l = 0))) but it did not work

Paul
  • 2,850
  • 1
  • 12
  • 37
glennca
  • 11
  • 1
  • 1
    FYI you need to use backticks (to the left of the `1` key on your keyboard), not single quotes, for code formatting. – Gregor Thomas Aug 10 '21 at 01:55
  • Does this answer your question? [Increase space between axis.title and axis.text in ggplot2 (version >= 0.9.0)](https://stackoverflow.com/questions/9131916/increase-space-between-axis-title-and-axis-text-in-ggplot2-version-0-9-0). Note that the `theme()` function, argument `margin =` needs `unit()` *i.e.* `theme( axis.title.x = element_text(margin = unit(c(5, 0, 0, 0), "mm"))))` – Paul Aug 10 '21 at 11:44
  • Gregor Thomas, what so you mean by this? Do I need to replace all quotation marks in my code with the ` key? – glennca Aug 11 '21 at 04:29

0 Answers0