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
4
votes
2 answers

How to skip nodes with NA value in ggsankey?

Suppose I have this dataset (the actual dataset has 30+ columns and thousands of ids) df <- data.frame(id = 1:5, admission = c("Severe", "Mild", "Mild", "Moderate", "Severe"), d1 = c(NA, "Moderate", "Mild",…
4
votes
0 answers

Confluencing/Merging Flows in ggalluvial

I need to create a particular type of plot using ggalluvial. From the vignette of the package: require(ggalluvial) data(vaccinations) vaccinations <- transform(vaccinations, response = factor(response,…
userq8957289475
  • 297
  • 1
  • 11
3
votes
1 answer

Adding label data to sankey plot axis with ggalluvial Package

How do I add label names in the white boxes to each of the three axis on the ggalluvial sankey plot from the dataframe? (see image) Column "Country" has observations for multiple countries. In the example below I am focused on Ireland which has the…
ceallac
  • 107
  • 9
2
votes
0 answers

ggalluvial or ggsankey - colours for different axis

I am trying to make an alluvial chart using ggalluvial on R. I was wondering if it is possible to have different colours for each segment (or between axis). In the example below, I have A on axis one going to B and C on axis 2. I would like two…
2
votes
2 answers

how to calculate percentages in geom_flow() based on variable size and not stratum size

I am trying the create an alluvial plot with geom_flow() and display the percentages of the flows. This works, however if I use more than two variables, I noticed that the percentages in the middle columns are smaller than I expected, to be exact…
Gilean0709
  • 1,098
  • 6
  • 17
2
votes
1 answer

ggalluvial: How to order the lines between blocks to be in same order as your data.frame?

I have made an alluvia plot using the ggalluvial package in R. I am trying to order the flows (lines between blocks) so that they are much easier to read - I am aiming for them to be stacked on top of each other (orange color, followed by purple…
Purrsia
  • 712
  • 5
  • 18
2
votes
1 answer

Group color/ flow so that the bars create a bar chart of first

I have a dataset that looks something like this: results <- as.data.frame(cbind(c("Violence", "Violence", "Violence", "Violence", "Economic", "Economic","Economic","Economic","Institutional","Institutional","Institutional","Institutional"), …
2
votes
2 answers

Change fontsizes of characters in alluvial Plot

I'm trying to fix this issue for quite some time now and no code seems to work here. I'm not that experienced in R, so maybe my problem is easy to fix. The following code shall present an Alluvial plot which links Bee nests to certain Trees. The…
LostInR
  • 21
  • 2
2
votes
1 answer

Add title above axis geom_alluvium

How to add a title above axis1 and axis2 in geom_alluvium? Similar to Current code: library(ggplot2) library(ggalluvial) df = data.frame( before = factor(c(4,2,3,1,1,1,2,4,2,2,1,4,3), labels = c("a","b","c","d")), after =…
s_baldur
  • 29,441
  • 4
  • 36
  • 69
2
votes
2 answers

Alluvial plot in R: how to space the strata?

Background I have been working on creating an alluvial plot (kind of Sankey diagram) using ggplot and the ggalluvial package to visualize frequency differences over time and their origins. As example, I have created a simple dataset of 100 imaginary…
user213544
  • 2,046
  • 3
  • 22
  • 52
2
votes
1 answer

Adjust the width of lines in alluvial chart based on numeric column

I create the alluvial chart below but weights are not taken into account, don’t know why; so all lines have same width. How can I adjust it? library(ggalluvial) library(magrittr) alpha <-…
firmo23
  • 7,490
  • 2
  • 38
  • 114
2
votes
1 answer

Is it possible to add tooltips in a Shiny app to a Sankey plot created with ggalluvial?

I am working on a Shiny app that includes an interactive Sankey diagram. My quandary is this: I prefer the aesthetics of the plots generated with the ggalluvial package (especially the ability to easily color links by some factor), but it does not…
qdread
  • 3,389
  • 19
  • 36
2
votes
3 answers

How to get percentages on the y axes in an alluvial or sankey plot?

I realized this graph using ggplot2 and I'd like to change y axes to percentages, from 0% to 100% with breaks every 10. I know I can use: + scale_y_continuous(label=percent, breaks = seq(0,1,.1)) but I still get a problem because, turning into…
jeff
  • 323
  • 1
  • 7
1
vote
1 answer

Creating Sankey or Alluvial plot and stopping the flow where the "next_node" and "next_x" value is "NA" in R

I am trying to create a Sankey or Alluvial plot using the ggplot2 library in R to visualize the flow of nodes based on the provided CSV data. The data includes columns for 'x', 'node', 'next_x', and 'next_node'. I want to create a plot where the…
Rohan Nath
  • 11
  • 2
1
vote
1 answer

Working with ggalluvial ggsankey library with missing combinations and dropouts

I'm trying to represent the movements of patients between several treatment groups measured in 3 different years. However, there're dropouts where some patients from 1st year are missing in the 2nd year or there are patients in the 2nd year who…
RobertoT
  • 1,663
  • 3
  • 12
1
2 3 4 5