line polt in ggplot with multiple y code example

Example: line polt in ggplot with multiple y

# Rule and Leaky Rule function
dat <- data.frame(
  x = c(-8,-7,-6,-5,-4,-3,-2,0,1,2,3,4,5,6,7,8,9,10), 
  fx=c(0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10), 
  fx2 = c( -0.08,-0.07,-0.06,-0.05,-0.04,-0.02,-0.01,0,1,2,3,4,5,6,7,8,9,10)
  
)
 


ggplot(data=dat, aes(x=x)) +
  geom_line(aes(y = fx), color="darkred")+
  geom_line(aes(y = fx2), color="steelblue", linetype="twodash")+
  theme(text = element_text(size=18))

Tags:

Misc Example