楼主: 3513_1609992162
723 1

[问答] ggplot分面作图后,怎么改变其中线条的类型。 [推广有奖]

  • 0关注
  • 1粉丝

已卖:57份资源

大专生

66%

还不是VIP/贵宾

-

威望
0
论坛币
716 个
通用积分
0.3845
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
362 点
帖子
9
精华
0
在线时间
101 小时
注册时间
2021-1-7
最后登录
2025-5-13

楼主
3513_1609992162 学生认证  发表于 2022-8-22 01:24:43 |AI写论文
100论坛币
下面是用ggplot作图的程序,求大神看看有没有可以解决的,运用了分面作图的函数后,不能改变其中线条的类型,用过scale_linetype_manual了,并没有变化。


library(dplyr)
library(ggplot2)
I020 = read.csv("I020.csv")

p1 <- ggplot(filter(I020, mu == 0 )) +
  geom_line(aes(x=lambda, y=power, colour = phi), size=1.5) +
  theme_bw() +
  scale_color_manual(values=c("orangered4","dodgerblue3","orange3","brown1","dodgerblue3","orange")) +
  #scale_linetype_manual(values=c("twodash","dotted","solid","twodash","dotted","solid"))+
  geom_hline(yintercept = 0.05, linetype = "dashed") +
  xlab(NULL) + ylab(NULL)+
  guides(colour = guide_legend( ncol = 1, byrow = TRUE))+
  guides(colour = guide_legend('',nrow = 1, byrow = TRUE)) +
  theme(legend.position = "bottom", legend.background = element_rect(colour = "black")) +
  facet_grid(DF ~ rho, labeller = labeller(rho = c(`-0.2` = "ρ=-0.2", `-0.4` = "ρ=-0.4",`-0.6` = "ρ=-0.6"),
                                         DF = c(`df=(10,10)` = "df=(10,10)", `df=(15,15)` = "df=(15,15)")))






关键词:gplot plot GPL Library ggplot2

沙发
cheetahfly 在职认证  发表于 2022-8-25 18:38:14
  geom_line(aes(x=lambda, y=power, colour = phi, linetype = phi), size=1.5)

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-30 18:08