ggplot2作图4

本文详细介绍了ggplot2库中的theme_bw()函数,通过展示从图1到图16的多个实例,揭示了该函数如何改变图表背景、字体、轴线等视觉元素,帮助读者理解并掌握ggplot2图形的主题定制。
摘要由CSDN通过智能技术生成

??theme_bw()参数的使用

??theme_bw()

##用法,其他的几个内部参数相同
theme_grey(
  base_size = 15,##整体布局字的缩放比例
  base_family = "bold",##所有的字体
  base_line_size = 1/10,##基本的线的粗细
  base_rect_size = 1/2
)

mtcars2 <- within(mtcars, {
  vs <- factor(vs, labels = c("V-shaped", "Straight"))
  am <- factor(am, labels = c("Automatic", "Manual"))
  cyl  <- factor(cyl)
  gear <- factor(gear)
})

p1 <- ggplot(mtcars2) +
  geom_point(aes(x = wt, y = mpg, colour = gear)) +
  labs(title = "Fuel economy declines as weight increases",
       subtitle = "(1973-74)",
       caption = "Data from the 1974 Motor Trend US magazine.",
       tag = "Figure 1",
       x = "Weight (1000 lbs)",
       y = "Fuel economy (mpg)",
       colour = "Gears")###关于标题和亚标题及图形字幕的说明

p1 + theme_gray() # the default               见图1
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值