R语言可视化(五)

墨蓝 2023-06-28 04:57 128阅读 0赞

可视化的坐标调整

可视化百度云资料链接为:
链接:https://pan.baidu.com/s/1vTRGZFVSAj17WXsgZPTwTQ
提取码:pkor

数据加载

  1. library(ggplot2)
  2. library(RColorBrewer)
  3. library(reshape2)
  4. df<-read.csv("Data.csv", header = TRUE)

绘图设置

  1. ggplot(data=df, aes(x=Time,y=value,fill=variable,shape=variable)) +
  2. geom_line()+
  3. geom_point(size=4,colour="black") +
  4. scale_fill_manual(values=c("#FF9641","#FF5B4E","#B887C3","#38C25D"))+
  5. scale_shape_manual(values=c(21,22,23,24))+
  6. theme_classic()+
  7. theme(
  8. text=element_text(size=14,color="black"),
  9. plot.title=element_text(size=14,family="myfont",face="bold.italic",hjust=.5,color="black"),
  10. legend.background = element_blank(),
  11. legend.position=c(0.2,0.8)
  12. )

在这里插入图片描述

坐标调整

  1. ggplot(data=df, aes(x=Time,y=value,fill=variable,shape=variable)) +
  2. geom_line()+
  3. geom_point(size=4,colour="black") +
  4. scale_fill_manual(values=c("#FF9641","#FF5B4E","#B887C3","#38C25D"))+
  5. scale_shape_manual(values=c(21,22,23,24))+
  6. scale_x_continuous(name="Time(d)",breaks=seq(0,20,2))+
  7. scale_y_continuous(breaks=seq(0,90,10),limits=c(0,90),expand =c(0, 1))+
  8. theme_classic()+
  9. theme(
  10. text=element_text(size=14,color="black"),
  11. plot.title=element_text(size=14,family="myfont",face="bold.italic",hjust=.5,color="black"),
  12. legend.background = element_blank(),
  13. legend.position=c(0.2,0.8)

在这里插入图片描述

参考资料1:https://github.com/EasyChart/Beautiful-Visualization-with-R/

参考资料2:https://blog.csdn.net/tandelin/article/details/87719623

发表评论

表情:
评论列表 (有 0 条评论,128人围观)

还没有评论,来说两句吧...

相关阅读