theme_grey() 默认背景,浅灰色背景和白色网格线,无边框; theme_bw() 类似默认背景,调整为白色背景和浅灰色网格线,无边框; theme_linedraw() 白色背景和黑色网格线,黑色边框线; theme_light() 白色背景和浅灰色网格线,浅灰色边框; theme_dark() 灰黑色背景和灰色网格线,灰色/无边框; theme
p+theme(legend.position = "bottom")#图例在底部 #也可以自定义 p+theme(legend.position = c(0.5, 0.7)) #为图例加边界 p+theme(legend.background = element_rect(color="red")) #或者为图例中的每个元素进行设置,如加边界 p+theme(legend.key =element_rect(color="red")) #进行填充 p+theme(leg...
ggplot图形的主题(theme)元素主要分为5大类:图形(plot)、面板(panel)、坐标轴(axis)、图例(Legend)和带形(Strip),通过theme()函数来统一控制图形的美学和文本特征,可以用于调整字体,背景色,前景色和网格线等。 对于面板的网格线,分为主线(panel.grid.major)和 次线(panel.grid.minor ),用户可以根据绘制图形的...
and uniform background. ##' @title A nice-looking ggplot2 theme ##' @param ... ##' Parameters passed to theme_classic() function. ##' @param bg ##' Color string (default 'white') for user defined uniform background. ##' @return ##' ggplot2 theme object. ##' @examples ##' ...
(dose ~ supp)+ theme( strip.background = element_rect( color="black", fill="#FC4E07", size=1.5, linetype="solid" ) ) #分面label的背景设置是theme里面的strip.background调整 p + facet_grid(dose ~ supp)+ theme( strip.background.x = element_rect( color="black", fill="#FC4E07",...
iris_plot+facet_nested(~Nester+Species,nest_line=element_line(linetype=2))+# 线型theme(strip.background=element_blank(),ggh4x.facet.nestline=element_line(colour="blue"))# 颜色 plot of chunk unnamed-chunk-9 可以把分面标签放在下面:
strip.text 分面标签文本 text strip.text.x strip.text.y 所有元素都在theme函数内使用element_line,element_rect,element_text和element_blank函数设置,使用方法参考这几个函数的参数说明即可,这里不再一一举例说明。 text, line, rect和title是最顶层的元素,理论上可以做全局设定,但当前版本ggplot2还没有实现,可...
theme_niwot <- function(){ theme_test()+ theme(axis.text.y=element_text(color="black",size =8.5), axis.ticks= element_blank(), strip.background = element_blank(), strip.text = element_blank(), panel.spacing.y = unit(0,"cm"), plot.background = element_blank(), panel.border =...
调整分面样式,如strip.background和strip.text.y。具体设置包括:strip.background = element_rect(fill = "pink"), strip.text.y = element_text(size = 14, angle = -90, face = "bold")五、使用已有主题并微调细节 使用theme_bw()作为基础主题,并使用theme()进行细节微调。具体设置包括:...
# 单一颜色e + geom_jitter(position = position_jitter(.2), color = "steelblue") + theme_minimal()# 不同分组不同颜色e + geom_jitter(aes(color = dose), position = position_jitter(.2)) + theme_minimal()手动设置颜色 e2 <- e + geom_jitter(aes(color = dose), position = position_...