万能的qplot——更精致的展现

2018.11.19 15:18
567 0 0

  之前的文章已经为大家介绍过了万能的qplot——基础,这次给大家说一说qplot的精致展现。

  一、组合geoms和stats

  d <- ggplot(diamonds, aes(carat)) + xlim(0, 3)

  d + stat_bin(aes(ymax = ..count..), binwidth = 0.1, geom = "area")

  d + stat_bin(

  aes(size = ..density..), binwidth = 0.1,geom = "point", position="identity")

  d + stat_bin(

  aes(y = 1, fill = ..count..), binwidth = 0.1,geom = "tile", position="identity")

组合geoms和stats.png

  二、基本作图类型

  1.线图

  p + geom_line() + ggtitle( "geom_line")

线图.png

  2.填充图

  p + geom_area() + ggtitle("geom_area")

填充图.png

  3.路径图

  p + geom_path() + ggtitle("geom_path")

路径图.png

  三、通过散点形状和大小控制重叠

  df <- data.frame(x = rnorm(2000), y = rnorm(2000))

  norm <- ggplot(df, aes(x, y))

  norm + geom_point()

  norm + geom_point(shape = 1)

  norm + geom_point(shape = ".") # Pixel sized

通过散点形状和大小控制重叠.png

  四、扰动(jitter)表示法

  jit <- position_jitter(width = 0.5)

  td + geom_jitter(position = jit)

  td + geom_jitter(position = jit, colour = alpha("black", 1/10))

  td + geom_jitter(position = jit, colour = alpha("black", 1/50))

  td + geom_jitter(position = jit, colour = alpha("black", 1/200))

扰动(jitter)表示法.png

  关于万能的qplot——更精致的展现的讲述就到这里了,上述的内容只是截取了资料中的一部分,如需获取完整的资料,可通过关注微信公众号后联系客服获取。

  想要了解更多的资料、信息,可持续关注我们,我们将为大家提供有价值、有需求的材料。为大家在整理数据时省去烦恼。

投诉文章 ©著作权归作者所有
喜欢  |  0
0/200字
没有更多评论了~
悬赏问题
给科研问题设置一定金额,将更容易获得关注与回答哦~
  • 1元
  • 3元
  • 5元
  • 8元
  • 18元
  • 自定义
选择支付方式
  • 微信支付
  • 支付宝支付
  • 余额支付
Copyright © 2014-2019 晟斯医学 All Rights Reserved. 备案号:苏ICP备11037034号-5 版权所有:南京孜文信息咨询有限公司