Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

In is_lodes_form( : Missing id-axis pairings.

library(dplyr)                                          # to manipulate data
library(alluvial)
allu <- data %>% 
        group_by(Diagnose1, Diagnose2, Diagnose3) %>%   # grouping
        summarise(Freq = n())                           # adding frequencies

# here the plot
alluvial(allu[,1:3], freq=allu$Freq)
Comment

In is_lodes_form( : Missing id-axis pairings.

A_col <- "firebrick3"
B_col <- "darkorange"
C_col <- "deepskyblue3"
alpha <- 0.7

ggplot(fb_ad_3d,
       aes(weight = freq, axis1 = Category, axis2 = Response)) +
  geom_alluvium(aes(fill = Response, color = Response), 
                width = 1/12, alpha = alpha, knot.pos = 0.4) +
  geom_stratum(width = 1/6, color = "grey") +
  geom_label(stat = "stratum", label.strata = TRUE) +
  scale_x_continuous(breaks = 1:2, labels = c("Category", "Response"))     +
  scale_fill_manual(values  = c(A_col, B_col, C_col)) +
  scale_color_manual(values = c(A_col, B_col, C_col)) +
  ggtitle("Relevance of Facebook Custom List Advertising") +
  theme_minimal() +
  theme(
   axis.text.x = element_text(size = 12, face = "bold")
  )
Comment

In is_lodes_form( : Missing id-axis pairings.

# Assume 'g' is the previous plot object saved under a variable
newdat <- layer_data(g)
newdat <- newdat[newdat$side == "start", ]
split <- split(newdat, interaction(newdat$stratum, newdat$x))
split <- lapply(split, function(dat) {
  dat$label <- dat$label / sum(dat$label)
  dat
})
newdat <- do.call(rbind, split)

ggplot(vaccinations,
       aes(x = survey, stratum = response, alluvium = subject,
           y = freq,
           fill = response, label = freq)) +
  scale_x_discrete(expand = c(.1, .1)) +
  geom_flow() +
  geom_stratum(alpha = .5) +
  geom_text(stat = "stratum", size = 3) +
  geom_text(data = newdat, aes(x = xmin + 0.4, y = y, label = format(label, digits = 1)),
            inherit.aes = FALSE) +
  theme(legend.position = "bottom") +
  ggtitle("vaccination survey responses at three points in time")
Comment

PREVIOUS NEXT
Code Example
Python :: draw a bow tie in python 
Python :: pystache unescaped characters 
Python :: santhal paragana 
Python :: iniciar un projecto de python con pyenv 
Python :: wxpython menu callback stackoverflow 
Python :: Young C so new(pro.cashmoneyap x nazz music) soundcloud 
Python :: convert code c++ to python online 
Python :: projects for beginners in python to complete 
Python :: from wireframe GUI design to python tkinter 
Python :: gcp functions save BQ 
Shell :: get cpu frequency linux 
Shell :: Pyperclip could not find a copy/paste mechanism for your system 
Shell :: how to install cv2 
Shell :: uninstall node js and npm ubuntu 
Shell :: update google chrome command ubuntu 
Shell :: kill process running on port mac 
Shell :: brew uninstall mysql 
Shell :: git list user and email 
Shell :: mysqlclient install ubuntu 
Shell :: Install redis on macbook pro 
Shell :: pip check for updates 
Shell :: stop nginx 
Shell :: conda install xlrd 
Shell :: uninstall qt creator ubuntu 
Shell :: install apollo 
Shell :: download pip for python in linux 
Shell :: python pip install r requirements txt 
Shell :: reset cache pods 
Shell :: uninstall scikit learn 
Shell :: uniinstall nginx 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =