Questions tagged [ggalluvial]

Use this tag for questions related to the ggalluvial package. The ggalluvial package extends the functionality of ggplot2 to make it easy to create alluvial charts in the R programming language.

The package extends the functionality of to make it easy to create alluvial charts in the programming language.

An overview and introduction to the package can be found on the package website

72 questions
0
votes
1 answer

How to order alluvials stratums in a custom way

I made this alluvial: As you can imagine, I would like the 9-16 to be between the 1-8 and the 17-24. This is my code: ggplot(data = werkuren_thuis_freq, aes(y = Freq, axis1 = s2_werkuren_thuis_voor, axis2 =…
Victor Nielsen
  • 443
  • 2
  • 14
0
votes
2 answers

Making an alluvial/sankey diagram using the first axis as the fill

I have this data: https://docs.google.com/spreadsheets/d/18sTSOzVEmSEI2KGfGSvRT_0BbzQ9n87kCGZH-cSULCs/edit?usp=sharing (put below the code to produce it) I use this code: library(ggplot2) library(ggalluvial) ggplot(data = modechoice, aes(y =…
Victor Nielsen
  • 443
  • 2
  • 14
0
votes
1 answer

Problem creating alluvial diagram using ggalluvial

I have this dataset: type <- c(1, 2, NA, 1, 2, NA) freq <- c(75, 12, 25, 69, 22, 32) time <- c("before", "before", "before", "after", "after", "after") df <- data.frame(type , freq, time ) I need to make a graph like this (with different data…
Victor Nielsen
  • 443
  • 2
  • 14
0
votes
1 answer

`ggalluvial`: `geom_flow` fill color from destination stratum

I have the following example: library(tidyverse) library(ggalluvial) data <- tibble(id = paste0("S", 1:20), class_1 = c(rep("A", 10), rep("B", 10)), class_2 = c(rep("A", 8), rep("B", 8), rep("A", 4))) data_pvt <- data %>% …
csgroen
  • 2,511
  • 11
  • 28
0
votes
1 answer

Alluvial plot with 2 different sources but a converging/shared variable [R]

I have experience with making alluvial plots using the ggalluvial package. However, I have run in to an issue where I am trying to create an alluvial plot with two different sources that converge onto 1 variable. here is example…
0
votes
1 answer

Formating dataframe for a ggalluvial plot between 2 categorical variables?

I have a dataframe with three categorical variables: classification1 : "1", "2", "3", "4" classification2 : "Low", "Med", "High" survival: "1" (alive), "2" (dead) The dataframe is composed of multiples rows, one for each individual. The 20 first…
B_slash_
  • 309
  • 2
  • 17
0
votes
1 answer

ggalluvial - let order of stratums follow dataset

I already searched for and looked at other answers to a similar (probably the same) question, but to be honest I don't get the respective answers since I am absolutely not into R. What I basically want to do is to show the relation of all the Arm…
Chilippso
  • 451
  • 2
  • 9
0
votes
0 answers

Incomplete expression in ggaluvial plot

I want to make an alluvial plot for presence of Antioxidant and No antioxidant vs gene hit(which has three categories, positive hit, negative hit and no hit) I wrote the following code for that but it gives me an error of incomplete expression Now I…
0
votes
1 answer

Using ggalluvial in R with the ggflags package

I am trying to reproduce somehow this chart UK plot with the ggalluvial package in R. But I do not know how to put the countries flags. I tried to create an ID variable as an y axis to use it with the ggflags…
marmol
  • 98
  • 3
  • 5
0
votes
0 answers

How to resolve problem with not recognized data in ggalluvial/ggplot2?

I would like to create a sankey/alluvial diagram in R. I have longitudal data: id state time 1 s_1 t_1 1 s_2 t_5 1 s_3 t_10 2 s_1 t_1 2 s_3 t_9 3 s_1 t_1 3 s_2 t_4 My code: df$id <- as.numeric(df$id) df$state <-…
Tom
  • 339
  • 2
  • 9
-1
votes
1 answer

Can't get geom_text to appear in ggalluvial

I have been using code that is verbatim to that in: https://www.r-bloggers.com/2022/10/how-to-create-a-ggalluvial-plot-in-r/ in order to produce an alluvial plot. While I can get the plot to appear: My Code: #install.packages("ggalluvial") …
-3
votes
1 answer

Alluvial plot for three variabes

From a dataframe like this: data.frame(status = c("open", "close", "close", "open/close","close"), stock = c("google", "amazon", "amazon", "yahoo", "amazon"), newspaper = c("times", "newyork", "london", "times",…
Erik Brole
  • 315
  • 9
1 2 3 4
5