4 默认主题以及自定义主题 ggplot2 自带主题 theme_grey()为默认主题,theme_bw()为白色背景主题,theme_classic()为经典主题。 代码语言:javascript 复制 p+theme_bw()+labs(subtitle="Change theme_bw") ggplot2 扩展包主题 代码语言:javascript 复制 library(ggthemes)p+theme_economist()+labs(subtitle="Change...
plot<-ggplot(data=NULL,aes(x=NULL,y=boxplot_data))+geom_boxplot()+theme_classic()print(plot) 1. 2. 3. 4. 5. 代码解释: plot <- ggplot(data = NULL, aes(x = NULL, y = boxplot_data)) + ...:将绘图对象赋值给变量plot。 print(plot):打印并显示绘图结果。 完整代码 下面是完整的...
如何使用theme\u classic函数在ggplot2中设置自定义颜色 我正在做一个ggplot,它显示了10个物种出现的概率(从0到1)与一个变量的百分比(x(6.15%到99.22%)的关系。 我正在使用函数ggplot和参数geom_line和theme_classic(下面是代码),我对这个图很满意,因为我可以手动将标准值更改为实际值作为分隔符和标签(抱歉,如果...
ggplot2 自带主题 theme_grey()为默认主题,theme_bw()为白色背景主题,theme_classic()为经典主题。 p+theme_bw()+labs(subtitle="Change theme_bw") ggplot2 扩展包主题 library(ggthemes)p+theme_economist() +labs(subtitle="Change theme_economist") ...
ggplot2 theme object. ##' @examples ##' library(ggplot2) ##' qplot(x=carat, y=price, color=cut, data=diamonds) + theme_zg() ##' @author ZGUANG ##' @export theme_zg <- function(..., bg='white'){ require(grid)theme_classic(...) + theme(rect=element_rect(fill=bg), plot...
ggplot2 自带主题 theme_grey()为默认主题,theme_bw()为白色背景主题,theme_classic()为经典主题。p + theme_bw() +labs(subtitle="Change theme_bw") ggplot2 扩展包主题 library(ggthemes)p + theme_economist() +labs(subtitle="Change theme_economist")#其他可选#theme_economist theme_economist_white ...
##' Parameters passed to theme_classic() function. ##' @param bg ##' Color string (default 'white') for user defined uniform background. ##' @return ##' ggplot2 theme object. ##' @example ##' library(ggplot2) ##' qplot(x=carat, y=price, color=cut, data=diamonds) + theme_zg...
# 绘制初始图形 p <- ggplot(data = diamond) +geom_point(aes(x=carat, y=price, colour=color,shape=cut)) + labs(title="学习ggplot2可视化",subtitle = "参数好多学不会?",caption = "熟能生巧") p 可以上图的标题,轴标签和图例已经默认设置好了,是否可以个性化修改呢? 当然可以!!! 输入?theme...
ggplot2 自带主题 theme_grey() 为默认主题, theme_bw() 为白色背景主题, theme_classic()为经典主题。 p + theme_bw() + labs(subtitle="Change theme_bw") ggplot2 扩展包主题 library(ggthemes) p + theme_economist() + labs(subtitle="Change theme_economist") #其他可选 #theme_economist theme_...
theme_minimal() 白色背景和浅灰色网格线,无边框; theme_classic() 类似R本身绘图的风格; theme_void() 完全空白 具体的图像可以参考这个网页18 Themes | ggplot2 (ggplot2-book.org)。但是其中的图像较小,可以复制代码后自己运行。 其他主题包 由Jeffrey Arnold 开发的ggthemes包,提供更多的主题选择,当然在期刊...