从gcookbook包中调用diamonds数据,应用carat和price数据做出基本散点图,在此基础上进行美化设计。 在可视化的过程中,主要利用了 RColorBrewer包进行色彩的调用(参考 https://www.cnblogs.com/homewch/archive/2016/07/25/5704153.html网址,有详细的调用说明) 今天也学习了theme函数中的相关参数设置(参考http://blog.sina.com.cn/s/blog_69ffa1f90101sigd.html)。 利用theme进行主题设置时,有四个重要函数的使用方式需要掌握: element_blank()element_rect(fill,colour,size,linetype,color,inheret.blank)element_line(coloue,size,linetype,lineend,color,arrow,inherit.blank)element_text(family,face,null,colour,size,hjust,vjust,angle,lineheight,color,margin,debug,inherit_blank) 在使用过程中,对应以上四种类型进行修改即可 参数设置内容继承自line所有线属性 rect所有矩形区域属性 text所有文本相关属性 title所有标题属性 axis.title坐标轴标题textaxis.title.xx轴属性axis.titleaxis.title.yy轴属性axis.titleaxis.text坐标轴刻度标签属性textaxis.text.x属性和继承和前面类似,不再重复 axis.text.y axis.ticks坐标轴刻度线lineaxis.ticks.x axis.ticks.y axis.ticks.length刻度线长度 axis.ticks.margin刻度线和刻度标签之间的间距 axis.line坐标轴线lineaxis.line.x axis.line.y legend.background图例背景rectlegend.margin图例边界 legend.key图例符号 legend.key.size图例符号大小 legend.key.height图例符号高度 legend.key.width图例符号宽度 legend.text图例文字标签 legend.text.align图例文字标签对齐方式0为左齐,1为右齐legend.title图例标题textlegend.title.align图例标题对齐方式 legend.position图例位置left, right, bottom, top, 两数字向量legend.direction图例排列方向"horizontal" or "vertical"legend.justification居中方式center或两数字向量legend.box多图例的排列方式"horizontal" or "vertical"legend.box.just多图例居中方式 panel.background绘图区背景rectpanel.border绘图区边框rectpanel.margin分面绘图区之间的边距 panel.grid绘图区网格线linepanel.grid.major主网格线 panel.grid.minor次网格线 panel.grid.major.x panel.grid.major.y panel.grid.minor.x panel.grid.minor.y plot.background整个图形的背景 plot.title图形标题 plot.margin图形边距top, right, bottom, leftstrip.background分面标签背景rectstrip.text分面标签文本textstrip.text.x strip.text.y