[关闭]
@Macux 2015-12-01T06:50:57.000000Z 字数 1218 阅读 1167

R语言_ggplot2_Lv1_Polishing

R语言_学习笔记


玩转内置的元素函数


(1)、生肉

  1. > hgramt <- ggplot(movies,aes(rating)) + geom_histogram(binwidth=1,fill="lightblue") + labs(title="This is a histogram")
  2. > hgramt

此处输入图片的描述

(2)、开始微调

  1. > hgramt + theme(plot.title = element_text(size = 30))

此处输入图片的描述

  1. > hgramt + theme(plot.title = element_text(size = 30, color="orange"))

此处输入图片的描述

  1. > hgramt + theme(plot.title = element_text(size = 30, hjust=1))

此处输入图片的描述

  1. > hgramt + theme(plot.title = element_text(size = 30, face="bold.italic"))

此处输入图片的描述

  1. > hgramt + theme(plot.title = element_text(size = 30, angle=180))

此处输入图片的描述


  1. > hgram <- ggplot(movies,aes(rating)) + geom_histogram(binwidth=1,fill="lightblue")
  2. > hgram + theme(panel.grid.major = element_line(linetype="dotted",size=2,color="orange"))

此处输入图片的描述

  1. > hgram + theme(axis.line = element_line(color="red",size=1.2,linetype="dashed"))

此处输入图片的描述


  1. > hgram + theme(plot.background = element_rect(fill = "lightgoldenrod1",colour=NA))

此处输入图片的描述

  1. > hgram + theme(panel.background = element_rect(fill="tan1",color=NA, linetype="dotted"))

此处输入图片的描述


  1. > hgramt + theme(panel.grid.minor = element_blank())

此处输入图片的描述

  1. > last_plot() + theme(panel.grid.major = element_blank())

此处输入图片的描述

  1. > last_plot() + theme(panel.background = element_blank())

此处输入图片的描述

  1. > last_plot() + theme(axis.title.x = element_blank(),axis.title.y = element_blank())

此处输入图片的描述

  1. > last_plot() + theme(axis.line=element_line(color="orange"))

此处输入图片的描述

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注