ggridges

How to add geom_point to stat_density_ridges

不问归期 提交于 2020-03-19 07:44:50
问题 I am able to draw density_ridge using this code. I want to add geom_point at percentile 0.50 without changing the current design. Any help would be much appreciated. library(ggplot2) library(ggridges) ggplot(iris, aes(x=Sepal.Length, y=Species, fill = factor(stat(quantile)))) + stat_density_ridges( geom = "density_ridges_gradient", calc_ecdf = TRUE, quantiles = 4, quantile_lines = TRUE ) 回答1: Try p + geom_point(data = aggregate(Sepal.Length ~ Species, iris, median), aes(x = Sepal.Length, y =

Visualization of Groups of Poisson random samples using ggridges

隐身守侯 提交于 2020-01-13 06:27:26
问题 I have two sets of data, all in one data frame. The first set is related to data collected in Location 1 and the second set is collected in Location 2. Each location has different count data (column value ) for 5 months. # DataSet ----------------- rp_data <- structure(list(Month = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 1L

How shade area under ggridges curve?

时光毁灭记忆、已成空白 提交于 2019-12-24 08:27:04
问题 I would like to highlight in red all temperatures above 20 degrees in multiple plots created by ggridges library(tidyverse) library(ggridges) ggplot(t2, aes(x = t, y = year)) + stat_density_ridges(geom = "density_ridges_gradient", quantile_lines = TRUE, quantiles = 2) + theme_ridges() Output of dput(t2) structure(list(Date = c("1853-01", "1853-02", "1853-03", "1853-04", "1853-05", "1853-06", "1853-07", "1853-08", "1853-09", "1853-10", "1853-11", "1853-12", "1854-01", "1854-02", "1854-03",

Adding a mean to geom_density_ridges

≡放荡痞女 提交于 2019-12-20 01:59:34
问题 I am trying to add means using geom_segment to a geom_density_ridges plot made in ggplot2. library(dplyr) library(ggplot2) library(ggridges) Fig1 <- ggplot(Figure3Data, aes(x = `hairchange`, y = `EffortGroup`)) + geom_density_ridges_gradient(aes(fill = ..x..), scale = 0.9, size = 1) ingredients <- ggplot_build(Fig1) %>% purrr::pluck("data", 1) density_lines <- ingredients %>% group_by(group) %>% filter(density == mean(density)) %>% ungroup() p <- ggplot(Figure3Data, aes(x = `hairchange`, y =

Visualization of Groups of Poisson random samples using ggridges

可紊 提交于 2019-12-04 17:43:17
I have two sets of data, all in one data frame. The first set is related to data collected in Location 1 and the second set is collected in Location 2. Each location has different count data (column value ) for 5 months. # DataSet ----------------- rp_data <- structure(list(Month = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L,

R: Weighted Joyplot/Ridgeplot/Density Plot?

五迷三道 提交于 2019-12-04 05:22:31
问题 I am trying to create a joyplot using the ggridges package (based on ggplot2 ). The general idea is that a joyplot creates nicely scaled stacked density plots. However, I cannot seem to produce one of these using weighted density. Is there some way of incorporating sampling weights (for weighted density) in the calculation of the densities in the creation of a joyplot? Here's a link to the documentation for the ggridges package: https://cran.r-project.org/web/packages/ggridges/ggridges.pdf I

Why does ggplot not allow suppressing of messages generated by its geoms?

谁说胖子不能爱 提交于 2019-12-04 00:17:17
问题 The geom_density_ridges geom from the ggridges package created ridgelines, and if a bandwidth is not specified, it attempts to find a sensible value. It then uses the base R message function to report that value (see https://twitter.com/ClausWilke/status/921363157553172480). The base R function suppressMessages function is designed to suppress such messages. For example, this code outputs a message: message('This is a message'); And this code outputs nothing: suppressMessages(message('This is