GGPLOT2:第一轴有两个图,第二轴有两个图

时间:2014-12-31 06:35:49

标签: r graph ggplot2

我有以下代码:

require(ggplot2) 
require(extrafont)

loadfonts(device="pdf")

#set the x-axis now 
xaxis <- seq(0,1, by=0.01)

#set the functions here 
aij <- sqrt(1 - (1-xaxis)**1.02)
bij <- 1 - (1 - xaxis)**1.50
cij <- aij - bij 

ggplot(transform(stack(data.frame(aij, bij, cij)), x = xaxis), 
       aes(x = x, y = values, linetype = ind)) +
  geom_line() + 
  theme_bw() + 
  xlab("x ratio") + 
  ylab("Function values") + 
  theme(text=element_text(family="Times New Roman", face="bold", size=12), 
        legend.title = element_blank()) + 
  scale_linetype_manual(values = c("solid", "dashed", "dotted"))

我希望在第二轴上绘制cij。怎么可能?

0 个答案:

没有答案