ggplot: theme capability

Non data elements of the plot is controlled by theme system.


theme give you control over things like fonts in all parts of the plot: title, axis labels, axis tick labels, strips ,

legends labels, legend key labels, color of ticks, grid lines, backgrounds(panel, plot, strip, legend)


1. built-in theme:

theme_gray()

theme_bw()


globally, affecting all plots when they are drawn: theme_set(theme_grey()) or theme_set(theme_bw())(note: this will return previous theme) 

locally, qplot(...)+theme_grey()


2. theme elements:

a theme made up of multiple elements which control appearance of a single item on the plot.



four basic built-in element functions: text, lines, rect,  and blank

element_text: draw labels and headings: control font family, face, color, size, hjust, vjust, angle, lineheight

element_line()


8.2 Customising scales:


set_default_scale(the name of the aesthetic, the type of variable(discrete or continuous) and the name of the scale to use as default

e.g. set_default_scale("color","discrete","grey")

set_default_scale("fill","discrete","grey")

set_default_scale("color",“continuous","gradient",low="white",high="black")


geoms and stats


e.g. update_geom_defaults("point",aes(color="darkblue"))

update_stat_defaults("bin",aes(y=..density..))


save plots:

1. ggsave(path,width=..,height=..,dpi=...)


8.4 multiple plots on the same page

use grid

viewport:a rectangular subregion of the display. The default viewport takes up the entire plotting region, and by
customising the viewport you can arrange a set of plots in just about any way
you can imagine




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值