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

2018.11.19 15:18
98 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
爱学术网-期刊论文服务平台 2014-2022 爱学术网版权所有
Copyright © 2014-2022 爱学术网 All Rights Reserved. 备案号:苏ICP备2020050931号 版权所有:南京传视绛文信息科技有限公司