Inspired by a visit to Tate Liverpool today, I created this force directed network graphic or ‘constellation’ which shows the relationship between Paul Cézanne’s ‘The Gardener Vallier’ and other artworks on show in the gallery.
library(networkD3)
df <- list(
links = data.frame(
source = c(6,11,5,10,7,1,0,4,9,8,2,12),
target = c(10,10,10,7,0,0,4,9,8,2,12,3),
value = 10
),
nodes = data.frame(
name = c("Albert Gleizes",
"Amedeo Modigliani",
"Auguste Renoir",
"Duncan Grant",
"Ernst Ludwig Kirchner",
"Georges Braque",
"Giacomo Balla",
"Henri Gaudier-Brzeska",
"Howard Hodgkin",
"Jean Metzinger",
"Paul Cézanne",
"Pierre Bonnard",
"William Ratcliffe"),
group = c(0,0,0,0,0,0,0,0,0,0,1,0,0),
size = c(5,5,5,5,5,5,5,5,5,5,20,5,5),
link = c("http://www.tate.org.uk/art/artworks/gleizes-portrait-of-jacques-nayral-t02410",
"http://www.tate.org.uk/art/artworks/modigliani-the-little-peasant-n05269",
"http://www.tate.org.uk/art/artworks/renoir-peaches-and-almonds-t03574",
"http://www.tate.org.uk/art/artworks/grant-the-mantelpiece-t01328",
"http://www.tate.org.uk/art/artworks/kirchner-bathers-at-moritzburg-t03067",
"http://www.tate.org.uk/art/artworks/braque-glass-on-a-table-t05028",
"http://www.tate.org.uk/art/artworks/balla-abstract-speed-the-car-has-passed-t01222",
"http://www.tate.org.uk/art/artworks/gaudier-brzeska-sophie-brzeska-t00147",
"http://www.tate.org.uk/search/howard%20hodgkin",
"http://www.tate.org.uk/art/artworks/metzinger-woman-with-a-coffee-pot-t00251",
"http://www.tate.org.uk/art/artworks/cezanne-the-gardener-vallier-n04724",
"http://www.tate.org.uk/art/artworks/bonnard-the-window-n04494",
"http://www.tate.org.uk/art/artworks/ratcliffe-attic-room-t03167")
)
)
cols <- 'd3.scale.ordinal()
.domain(["0", "1"])
.range(["#525252", "#f16913"]);'
fn <- forceNetwork(Links = df$links,
Nodes = df$nodes,
Source = "source",
Target = "target",
Value = "value",
NodeID = "name",
Nodesize = "size",
Group = "group",
height = NULL,
width = 900,
colourScale = JS(cols),
fontSize = 12,
fontFamily = "Courier New",
linkDistance = 200,
linkWidth = 1,
charge = -400,
linkColour = "#525252",
opacity = 0.8,
zoom = TRUE,
legend = FALSE,
bounded = FALSE,
opacityNoHover = 0.8)
fn$x$nodes$hyperlink <- paste0(df$nodes$link
)
fn$x$options$clickAction = 'window.open(d.hyperlink)'
fn
credits: networkD3 and http://stackoverflow.com/a/36974105