R GGPLOT-在B_W模式下一个图中的两条曲线
我有下面的一段代码,我写这段代码是为了为我在论文中的文章生成一个黑白图像R GGPLOT-在B_W模式下一个图中的两条曲线,r,graph,ggplot2,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 #p
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
#plot using commands
ggplot(,aes(xaxis)) + geom_line(aes(y=aij, colour="aij")) +
geom_line(aes(y=bij,colour="bij"),linetype="dashed") +
theme_bw() +
xlab("x ratio") +
ylab("Function values") +
theme(text=element_text(family="Times New Roman", face="bold", size=12))
ggsave('myGraph.pdf')
require(ggplot2)
需要(外部字体)
#加载字体(device=“pdf”)
#现在设置x轴
xaxis(1)
(二)
(三)
全部加在一起,例如:
ggplot(transform(stack(data.frame(aij, bij)), 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"))
给
(1)
(二)
(三)
全部加在一起,例如:
ggplot(transform(stack(data.frame(aij, bij)), 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"))
给
(1)
(二)
(三)
全部加在一起,例如:
ggplot(transform(stack(data.frame(aij, bij)), 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"))
给
(1)
(二)
(三)
全部加在一起,例如:
ggplot(transform(stack(data.frame(aij, bij)), 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"))
给