Skip to content

Instantly share code, notes, and snippets.

@briatte
Last active January 1, 2016 20:29
Show Gist options
  • Save briatte/8197456 to your computer and use it in GitHub Desktop.
Save briatte/8197456 to your computer and use it in GitHub Desktop.
egocentric cosponsorship networks in the French National Assembly
library(network)
library(sna)
load("data/session14.rda")
u = ego.extract(net)
plot.ego <- function(u, deputes, x, ...) {
n = network(u[[ which(names(u) == x) ]])
n %v% "groupe" = deputes[ network.vertex.names(n), "groupe_sigle" ]
n %v% "ego" = (network.vertex.names(n) == x)
k = net %n% "colors"
k = k [ which(names(net %n% "colors") %in% unique(n %v% "groupe")) ]
ggnet(n, mode = "kamadakawai", node.group = n %v% "groupe", node.color = k, size = 4, weight = "none",
segment.color = "grey35", segment.alpha = .05, ...) +
geom_point(color = k [ deputes[ x, "groupe_sigle" ] ], size = 8 * as.numeric(n %v% "ego")) +
ggtitle(x) +
guides(size = FALSE)
}
plot.ego("ISABELLE ATTARD")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment