【问题标题】:How to mix a densities functions and a time series graph如何混合密度函数和时间序列图
【发布时间】:2018-08-04 12:02:23
【问题描述】:

有没有办法在时间序列上绘制密度?我正在寻找这样的东西:

【问题讨论】:

标签: r plot time-series timeserieschart


【解决方案1】:

克劳斯·威尔克在ggridges package 的小插曲中有some great examples of exactly this。这是一个可重现的说明它是如何完成的:

library(ggridges)
library(ggplot2movies)

ggplot(movies[movies$year>1912,], aes(x = length, y = year, group = year)) +
  geom_density_ridges(scale = 10, size = 0.25, rel_min_height = 0.03) +
  theme_ridges() +
  scale_x_continuous(limits=c(1, 200), expand = c(0.01, 0)) +
  scale_y_reverse(breaks=c(2000, 1980, 1960, 1940, 1920, 1900), expand = c(0.01, 0))

电影长度(按年份)

【讨论】:

    猜你喜欢
    • 2015-01-30
    • 1970-01-01
    • 1970-01-01
    • 2015-12-21
    • 1970-01-01
    • 2020-06-05
    • 1970-01-01
    • 2021-10-12
    • 1970-01-01
    相关资源
    最近更新 更多