Home > Software design >  Can't change ylab in ggplot
Can't change ylab in ggplot

Time:06-17

When I create this plot, I realize even I specify ylab, it is not applied to the output plot, whereas other labs works perfectly. Code below:

 saturation = function(po2,L){((po2/5.5)*(1 (po2/5.5))^3 
                                L*(po2/300)*(1 (po2/300))^3)/((1 (po2/5.5))^4 L*(1 (po2/300))^4)} #enter the equation
library(ggplot2)
library(ggtext)

labels = '<p><span style="color: #304d63;">L = 10</span>, 
<span style="color: #b2e7e8;">L = 30</span>, 
<span style="color: #8fb9aa;">L = 100</span>, 
<span style="color: #f2d096;">L = 300</span>, 
<span style="color: #ed8975;">L = 1000</span>, 
<span style="color: #8c695d;">L = 3000</span></p>'
color_scheme = c("#304D63", "#B2E7E8", "#8FB9aa",'#F2D096',"#Ed8975",'#8C695D')
Ls = c(10,30,100,300,1000,3000)

plot = ggplot()  xlim(0,150)
for(i in 1:6){
  plot = plot   geom_function(fun = saturation,args = list (L= Ls[i]),color = color_scheme[i])

}
plot = plot   labs(title = 'figure 1', xlab = 'pO2',ylab = '%hemeglobin bound',subtitle=(labels)) 
  theme(plot.subtitle = element_markdown())

plot

and the output is below:enter image description here

  • Related