ggsankey | Make sankey , alluvial and sankey bump plots in ggplot | Data Visualization library
kandi X-RAY | ggsankey Summary
kandi X-RAY | ggsankey Summary
The goal of ggsankey is to make beautiful sankey, alluvial and sankey bump plots in ggplot2.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ggsankey
ggsankey Key Features
ggsankey Examples and Code Snippets
Community Discussions
Trending Discussions on ggsankey
QUESTION
I am making a Sankey diagram with ggalluvial
.
Here is my dataset
...ANSWER
Answered 2021-Dec-11 at 18:29In the end, ggaluvial
seems more adapted to my problem:
Here is the data formating:
QUESTION
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 data
...ANSWER
Answered 2021-Dec-10 at 17:58This plot is the expected result of the "flow" statistical transformation, which is the default for the "flow" graphical object. (That is, geom_flow()
= geom_flow(stat = "flow")
.) It looks like what you want is to specify the "alluvium" statistical transformation instead. Below i've used all your code but only copied and edited the ggplot()
call.
QUESTION
I am trying to make an income to expenses sankey diagram, preferably with ggsankey
or another ggplot extension, because I need the final plot as an image (png). Here is my data:
ANSWER
Answered 2021-Oct-30 at 21:50library(tidyverse)
library(networkD3)
data <- tibble::tribble(
~Name, ~Annual.Amount, ~Category,
"Moira's Earnings", 50000L, "Income",
"Johnny's Earnings", 300000L, "Income",
"Living Expenses", 140000L, "Expenses",
"Spent Savings", 25238L, "Expenses",
"Liabilities", 44280L, "Expenses",
"Planned Savings", 23000L, "Expenses",
"Taxes", 98482L, "Expenses",
"Insurance", 13000L, "Expenses"
)
Nodes = tibble(
Name = c(data$Name, "Budget") %>% unique()
) %>% as.data.frame()
df = data %>% filter(Category=="Income") %>%
select(-Category) %>%
rename(Source = Name) %>%
mutate(Target = "Budget") %>%
bind_rows(
data %>%
filter(Category=="Expenses") %>%
select(-Category) %>%
rename(Target = Name) %>%
mutate(Source = "Budget")
) %>% mutate(
IDSource = match(Source, Nodes$Name)-1,
IDTarget = match(Target, Nodes$Name)-1
) %>% as.data.frame()
sankeyNetwork(Links = df, Nodes = Nodes,
Source = "IDSource", Target = "IDTarget",
Value = "Annual.Amount", NodeID = "Name",
sinksRight=FALSE, fontSize = 16)
QUESTION
Background
I am creating a Sankey Diagram in R and I am struggling with labeling the nodes.
As example, I will reuse a dataset with 10 imaginary patients that are screened for COVID-19. At baseline, all patients are negative for COVID-19. After let’s say 1 week, all patients are tested again: now, 3 patients are positive, 6 are negative and 1 has an inconclusive result. Yet another week later, the 3 positive patients remain positive, 1 patient goes from negative to positive, and the others are negative.
...ANSWER
Answered 2021-Apr-20 at 17:12Try this:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ggsankey
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page