两个内置主题theme_grey()和theme_bw(),分别为灰底白网格线和白底灰网格线。 唯一参数base_size控制基础字体的大小。基础字体指做标题的大小,图形标题比它大20%,轴须标签比它小20%。全局性设置:theme_set(theme_grey())或theme_set(theme ggplot2 ...
期刊投稿时一般对 figure 的字体大小 (font size) 和线宽 (line width) 有特定的要求,e.g., "Size any text in your figure to at least 6–8 points", "graph lines at least 0.25 points wide"。这里的 point(pt)翻译为点,也音译磅因、磅,是印刷所使用的长度单位。1 点的标准并不统一,当代最通行...
library(ggplot2) theme_set(theme_bw()) # Plot ggplot(mtcars, aes(x=`car name`, y=mpg_z, label=mpg_z)) + geom_point(stat='identity', aes(col=mpg_type), size=6) + scale_color_manual(name="Mileage", labels = c("Above Average", "Below Average"), values = c("above"="#00b...
bp + font("x.text", size = 10), ncol = 1, nrow = 2) annotate_figure(figure, top = text_grob("Visualizing mpg", color = "red", face = "bold", size = 14), bottom = text_grob("Data source: \n mtcars data set", color = "blue", hjust = 1, x = 1, face = "italic",...
theme_set(old);p theme_update()函数和theme_replace()函数是一对相爱相杀的函数,两者存在着微妙的关系,也是涉猎不神的初学者最容易困惑的两个主题函数。 这里澄清一下(也是参考ggplot2官网上的原文解释),theme_update()与theme_replace()函数都可以起到修改主题的作用,但是不同的是二者在修改主题的时候作用方式...
old <-theme_set(theme_bw());p theme_set(old);p theme_update()函数和theme_replace()函数是一对相爱相杀的函数,两者存在着微妙的关系,也是涉猎不神的初学者最容易困惑的两个主题函数。 这里澄清一下(也是参考ggplot2官网上的原文解释),theme_update()与theme_replace()函数都可以起到修改主题的作用,但是...
A ggplot Memo: Legend, Label and Font Size 1. Introductionggplot is one of the most famous library in R and I use it very ofen in daily workflow. But there are three topics I seldomly touch before: legend, label and font size.
(enable=TRUE)# 添加字体font.add('SimSun','simsun.ttc')# Modify theme components# 修改主题gg+theme(# 设置标题plot.title=element_text(size=20,# 字体大小face="bold",# 字体加粗family="SimSun",# 字体类型color="tomato",# 字体颜色hjust=0.5,# 标题离左边距距离lineheight=1.2),# 线条高度# 设置...
require(cowplot)theme_set(theme_cowplot(font_size=12))# reduce default font sizeplot.mpg<-ggplot(mpg,aes(x=cty,y=hwy,colour=factor(cyl)))+geom_point(size=2.5)plot.diamonds<-ggplot(diamonds,aes(clarity,fill=cut))+geom_bar()+theme(axis.text.x=element_text(angle=70,vjust=0.5))plot_grid...
library(yyplot)g<-set_font(p,family="gochi",color="firebrick",size=5)grid::grid.draw(g)# 最后需要手动输出一下 ps:y 叔叔的这个包有点粗暴,全部文字都变啦~ 当然这个包,我还是以好玩为主~ 参考资料 [1]设置ggplot所有字体 (guangchuangyu.github.io):https://guangchuangyu.github.io/cn/2017/09...