Git Product home page Git Product logo

ggraph's Introduction

ggraph

R-CMD-check CRAN_Release_Badge CRAN_Download_Badge Codecov test coverage

/dʒiː.dʒɪˈrɑːf/ (or g-giraffe)

A grammar of graphics for relational data

ggraph is an extension of ggplot2 aimed at supporting relational data structures such as networks, graphs, and trees. While it builds upon the foundation of ggplot2 and its API it comes with its own self-contained set of geoms, facets, etc., as well as adding the concept of layouts to the grammar.

An example

library(ggraph)
#> Loading required package: ggplot2
library(tidygraph)
#> 
#> Attaching package: 'tidygraph'
#> The following object is masked from 'package:stats':
#> 
#>     filter

# Create graph of highschool friendships
graph <- as_tbl_graph(highschool) |> 
    mutate(Popularity = centrality_degree(mode = 'in'))

# plot using ggraph
ggraph(graph, layout = 'kk') + 
    geom_edge_fan(aes(alpha = after_stat(index)), show.legend = FALSE) + 
    geom_node_point(aes(size = Popularity)) + 
    facet_edges(~year) + 
    theme_graph(foreground = 'steelblue', fg_text_colour = 'white')

The core concepts

ggraph builds upon three core concepts that are quite easy to understand:

  1. The Layout defines how nodes are placed on the plot, that is, it is a conversion of the relational structure into an x and y value for each node in the graph. ggraph has access to all layout functions available in igraph and furthermore provides a large selection of its own, such as hive plots, treemaps, and circle packing.
  2. The Nodes are the connected entities in the relational structure. These can be plotted using the geom_node_*() family of geoms. Some node geoms make more sense for certain layouts, e.g. geom_node_tile() for treemaps and icicle plots, while others are more general purpose, e.g. geom_node_point().
  3. The Edges are the connections between the entities in the relational structure. These can be visualized using the geom_edge_*() family of geoms that contain a lot of different edge types for different scenarios. Sometimes the edges are implied by the layout (e.g. with treemaps) and need not be plotted, but often some sort of line is warranted.

All of the tree concepts have been discussed in detail in dedicated blog posts that are also available as vignettes in the package. Please refer to these for more information.

Note: The linked blog posts are based on ggraph v1. After ggraph v1.1 the underlying implementation was moved to tidygraph and cleaned up, but this resulted in some breaking changes in the process. Therefore the vignette versions are generally recommended as they have been updated.

Supported data types

There are many different ways to store and work with relational data in R. ggraph is built upon tidygraph and the large swath of data structures it supports are thus natively supported in ggraph. In order to get a data type supported by ggraph, simply provide an as_tbl_graph method for it.

Installation

ggraph is available through CRAN and can be installed with install.packages('ggraph'). The package is under active development though and the latest set of features can be obtained by installing from this repository using devtools

# install.packages("pak")
pak::pak('thomasp85/ggraph')

Related work

ggraph is not the only package to provide some sort of support for relational data in ggplot2, though I’m fairly certain that it is the most ambitious. ggdendro provides support for dendrogram and hclust objects through conversion of the structures into line segments that can then be plotted with geom_segment(). ggtree provides more extensive support for all things tree-related, though it lacks some of the layouts and edge types that ggraph offers (it has other features that ggraph lacks though). For more standard hairball network plots ggnetwork, geomnet, and GGally all provide some functionality though none of them are as extensive in scope as ggraph.

Code of Conduct

Please note that the ‘ggraph’ project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

ggraph's People

Contributors

arcresu avatar billdenney avatar charliejhadley avatar floresfdev avatar klmr avatar kpj avatar loreabad6 avatar malcolmbarrett avatar rcannood avatar ruaridhw avatar schochastics avatar sumedh10 avatar thomasp85 avatar zkamvar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ggraph's Issues

matrix layout with matching geoms

A rundown of interesting sorting algorithms are given in Matrix Reordering Methods for Table and Network Visualization by Behrisch et al. (2016) (link)

Trouble installing ggraph

I am having trouble installing the current version of ggraph (which is, sadly for us, meaning that @dgrtwo and I can't build our book at all right now). I get the following error both locally on Mac OS and on Travis when trying to install ggraph:

Error in .install_package_code_files(".", instdir) : 
files in 'Collate' field missing from '/private/var/folders/0w/prb4hnss2gn1p7y34qb2stw00000gp/T/Rtmp33Y2Ij/devtoolsea3d94ea05f/thomasp85-ggraph-cb08439/R':
  geom_edge_text.R
ERROR: unable to collate and parse R files for package ‘ggraph’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/ggraph’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/ggraph’
Error: Command failed (1)

I get this error both when installing ggraph after installing ggplot2 and ggforce from CRAN or from GitHub. I was able to build the book as of yesterday (I think?) so might this be a new problem?

Edge-guide control

I am not able to control edge-color guides, whether legends or colorbars, and whether the color is set to an edge attribute or ..index.. A few examples:

library(ggraph)
library(igraph)
set.seed(82)
g = graph_from_edgelist(matrix(sample(letters, 100, TRUE), ncol = 2))
E(g)$type = rep(1:5, 10)

ggraph(g, lay = "igraph", alg = "kk") +
  geom_node_point() + 
  geom_edge_fan(aes(color = ..index..)) +
  scale_edge_color_gradient(breaks = c(.1, .9), labels = c("sender", "receiver")) + 
  guides(color = guide_colorbar(barwidth = 0.3))

# Throws an error:
# scale_edge_color_gradient(breaks = c(.1, .9), labels = c("sender", "receiver"),
#                           guide = guide_colorbar(barwidth = 0.3))

ggraph(g, lay = "igraph", alg = "kk") +
  geom_node_point() + 
  geom_edge_fan(aes(color = type)) +
  guides(color = guide_colorbar(barwidth = 0.3))

ggraph(g, lay = "igraph", alg = "kk") +
  geom_node_point() + 
  geom_edge_fan(aes(color = factor(type))) +
  guides(color = guide_legend("Title"))

Installation problems related to udunits2

Hi,
In our Rstudio server pro (redhat linux) environment we can't seem to install ggforce or ggraph because of configuration failures for the udunits2 package. I realize you aren't the maintainer of udunits2, but was curious if you've heard this before and/or knew of some solution. I've been in touch with udunits2 maintainer, but haven't heard back from them.

ERROR: configuration failed for package ‘udunits2’

  • removing ‘/mnt/enc1/home/R/x86_64-redhat-linux-gnu-library/3.3/udunits2’
    Warning in install.packages :
    installation of package ‘udunits2’ had non-zero exit status
    ERROR: dependency ‘udunits2’ is not available for package ‘units’
  • removing ‘/mnt/enc1/home/R/x86_64-redhat-linux-gnu-library/3.3/units’
    Warning in install.packages :
    installation of package ‘units’ had non-zero exit status
    ERROR: dependency ‘units’ is not available for package ‘ggforce’
  • removing ‘/mnt/enc1/home/R/x86_64-redhat-linux-gnu-library/3.3/ggforce’
    Warning in install.packages :
    installation of package ‘ggforce’ had non-zero exit status

Thankfully this doesn't appear to be a problem on local windows desktop installations, but it would be nice to have this working on Rstudio server pro too.

Thanks,
Aaron

Summarise layouts in one place

Current steps:

  • ?ggraph
  • click createLayout
  • click layout_igraph_igraph
  • click layout_
  • randomly click around see also, trying to find a layout that does what I want

Need someway to feed labels into layout spec

Ideally here the arrows would touch the closest side of the label.

library(igraph)
#> 
#> Attaching package: 'igraph'
#> The following objects are masked from 'package:stats':
#> 
#>     decompose, spectrum
#> The following object is masked from 'package:base':
#> 
#>     union
library(ggraph)
#> Loading required package: ggplot2

gr <- make_graph('bull')
E(gr)$class <- sample(letters[1:3], gsize(gr), replace = TRUE)
V(gr)$class <- sample(letters[1:3], gorder(gr), replace = TRUE)

ggraph(gr, 'igraph', algorithm = 'nicely') +
  geom_edge_link0(arrow = grid::arrow(length = unit(0.5, "cm"), type = "closed")) + 
  geom_node_label(aes(label = class), repel = TRUE, label.padding = unit(1, "lines"))

Combine ggraph with ggmap

I'm experiencing difficulty plotting a ggraph on top of a ggmap (metioned it on twitter).

Here's the code I'm running to create the graph and the map:

# Create graph
tot_gr <- tot_adjacency %>% 
    mutate(line = as.factor(line)) %>% 
    graph_from_data_frame(directed = FALSE, vertices = stations)


# Set up the layout using lat and lon
lay <- stations %>% dplyr::rename(y = latitude, x = longitude)

# Create graph layout
lay_data <- createLayout(tot_gr, 'manual', node.positions = lay)

# Set up colours
line_cols <- paste0('#', lines$colour)
names(line_cols) <- lines$name

tube_map <- ggraph(tot_gr, 'manual', data = lay_data) +
    geom_node_point(size = .5) +
    geom_edge_fan(aes(colour = line_name, edge_width = daily_trips), 
                  show.legend = F, edge_alpha = 1) +
    scale_edge_colour_manual(name = "Line", values = line_cols) +
    theme_void() 


map <- get_map(location = c(lon = -0.1275, lat = 51.5072), maptype = "toner-lite")
map_plot <- ggmap(map)

If I then run:

map_plot + tube_map

I get the following error:

Error: Don't know how to add o to a plot

I feel like this could be due to the different names for the aesthetics in the two plots (ggmap uses lat/lon whereas ggraph insists on x and y) but I'm not convinced this is the case.

Appreciate if you can take a look and make some suggestions. If there's any digging I can do on my end to help out, let me know! Thanks.

Here are the data necessary:

# tot_adjacency
tot_adjacency <- structure(list(station1 = c(11L, 11L, 49L, 49L, 82L, 82L, 84L, 
87L, 113L, 113L, 114L, 137L, 137L, 140L, 143L, 143L, 148L, 159L, 
185L, 185L, 192L, 192L, 193L, 246L, 13L, 13L, 16L, 16L, 24L, 
24L, 28L, 28L, 37L, 37L, 48L, 48L, 51L, 51L, 68L, 68L, 72L, 76L, 
76L, 88L, 91L, 98L, 98L, 103L, 105L, 105L, 112L, 112L, 126L, 
127L, 127L, 149L, 149L, 153L, 153L, 154L, 154L, 164L, 177L, 181L, 
186L, 192L, 211L, 215L, 221L, 221L, 226L, 230L, 241L, 2L, 2L, 
11L, 11L, 14L, 14L, 18L, 18L, 25L, 25L, 44L, 44L, 83L, 87L, 87L, 
90L, 90L, 92L, 99L, 99L, 122L, 156L, 166L, 229L, 229L, 248L, 
248L, 3L, 3L, 15L, 15L, 17L, 17L, 18L, 18L, 21L, 21L, 25L, 25L, 
33L, 306L, 33L, 36L, 44L, 44L, 52L, 52L, 66L, 66L, 72L, 73L, 
74L, 74L, 74L, 74L, 74L, 78L, 80L, 80L, 83L, 85L, 87L, 87L, 96L, 
96L, 99L, 108L, 108L, 110L, 122L, 129L, 141L, 164L, 166L, 195L, 
200L, 200L, 209L, 229L, 229L, 231L, 242L, 244L, 248L, 248L, 267L, 
299L, 41L, 41L, 174L, 175L, 216L, 225L, 225L, 228L, 3L, 3L, 11L, 
11L, 14L, 14L, 15L, 33L, 305L, 33L, 36L, 78L, 83L, 90L, 90L, 
92L, 101L, 101L, 147L, 147L, 150L, 156L, 164L, 193L, 200L, 200L, 
218L, 244L, 11L, 11L, 23L, 23L, 28L, 41L, 42L, 43L, 43L, 45L, 
45L, 71L, 71L, 94L, 94L, 107L, 142L, 142L, 144L, 144L, 157L, 
172L, 233L, 247L, 249L, 279L, 2L, 6L, 11L, 11L, 14L, 14L, 46L, 
46L, 53L, 62L, 62L, 75L, 75L, 90L, 90L, 92L, 304L, 94L, 115L, 
115L, 115L, 125L, 125L, 134L, 156L, 168L, 168L, 178L, 179L, 180L, 
184L, 202L, 210L, 220L, 7L, 7L, 8L, 8L, 12L, 12L, 13L, 13L, 22L, 
22L, 29L, 29L, 34L, 34L, 38L, 38L, 40L, 40L, 40L, 40L, 49L, 49L, 
54L, 54L, 55L, 58L, 59L, 59L, 77L, 77L, 84L, 87L, 89L, 89L, 89L, 
93L, 93L, 100L, 102L, 102L, 121L, 136L, 136L, 139L, 151L, 167L, 
169L, 191L, 257L, 261L, 288L, 1L, 1L, 1L, 5L, 5L, 9L, 9L, 10L, 
10L, 17L, 17L, 30L, 30L, 31L, 39L, 39L, 57L, 60L, 60L, 73L, 74L, 
75L, 75L, 99L, 107L, 107L, 110L, 116L, 116L, 116L, 117L, 125L, 
125L, 126L, 130L, 130L, 131L, 133L, 134L, 145L, 146L, 151L, 160L, 
176L, 182L, 187L, 210L, 220L, 235L, 251L, 266L, 26L, 26L, 35L, 
89L, 89L, 95L, 95L, 107L, 107L, 123L, 192L, 198L, 198L, 224L, 
245L, 13L, 4L, 4L, 13L, 19L, 20L, 20L, 27L, 27L, 32L, 32L, 42L, 
42L, 43L, 43L, 61L, 61L, 63L, 63L, 64L, 64L, 65L, 69L, 69L, 86L, 
120L, 135L, 155L, 155L, 201L, 201L, 203L, 204L, 225L, 284L, 95L, 
43L), station2 = c(163L, 212L, 87L, 197L, 163L, 193L, 148L, 279L, 
246L, 298L, 140L, 206L, 298L, 237L, 159L, 206L, 279L, 278L, 237L, 
281L, 197L, 212L, 278L, 281L, 156L, 250L, 91L, 173L, 156L, 164L, 
162L, 192L, 158L, 301L, 126L, 250L, 103L, 215L, 158L, 256L, 286L, 
181L, 296L, 256L, 109L, 173L, 211L, 109L, 177L, 196L, 181L, 196L, 
259L, 186L, 226L, 162L, 208L, 154L, 247L, 230L, 275L, 247L, 239L, 
286L, 208L, 259L, 275L, 301L, 239L, 294L, 296L, 241L, 301L, 156L, 
263L, 83L, 104L, 92L, 167L, 186L, 193L, 161L, 255L, 161L, 166L, 
193L, 255L, 285L, 104L, 145L, 145L, 122L, 236L, 186L, 167L, 263L, 
236L, 273L, 273L, 285L, 263L, 295L, 78L, 269L, 110L, 293L, 186L, 
193L, 67L, 269L, 161L, 255L, 36L, 307L, 164L, 289L, 161L, 166L, 
1L, 265L, 67L, 85L, 73L, 1L, 99L, 122L, 138L, 287L, 293L, 270L, 
205L, 231L, 193L, 129L, 255L, 285L, 195L, 287L, 236L, 141L, 265L, 
209L, 186L, 268L, 213L, 244L, 263L, 205L, 270L, 289L, 242L, 236L, 
273L, 300L, 265L, 295L, 273L, 285L, 268L, 300L, 216L, 253L, 253L, 
253L, 276L, 276L, 295L, 295L, 156L, 295L, 83L, 104L, 92L, 167L, 
78L, 36L, 306L, 164L, 289L, 270L, 193L, 104L, 145L, 145L, 110L, 
227L, 150L, 283L, 227L, 167L, 244L, 218L, 270L, 289L, 283L, 295L, 
28L, 249L, 41L, 157L, 107L, 42L, 183L, 183L, 289L, 207L, 243L, 
172L, 297L, 254L, 290L, 285L, 290L, 297L, 207L, 282L, 233L, 282L, 
279L, 289L, 254L, 285L, 156L, 46L, 104L, 94L, 92L, 167L, 50L, 
53L, 214L, 168L, 280L, 210L, 222L, 104L, 145L, 145L, 305L, 282L, 
178L, 184L, 291L, 134L, 271L, 220L, 167L, 179L, 214L, 202L, 180L, 
199L, 199L, 282L, 291L, 222L, 145L, 188L, 124L, 264L, 56L, 257L, 
157L, 167L, 47L, 111L, 84L, 157L, 100L, 119L, 58L, 81L, 47L, 
89L, 139L, 170L, 87L, 151L, 55L, 56L, 245L, 119L, 240L, 258L, 
93L, 124L, 136L, 279L, 145L, 170L, 277L, 165L, 288L, 111L, 259L, 
277L, 261L, 191L, 279L, 264L, 259L, 188L, 240L, 245L, 258L, 302L, 
302L, 73L, 234L, 265L, 194L, 252L, 31L, 232L, 128L, 95L, 74L, 
110L, 176L, 190L, 303L, 128L, 145L, 187L, 126L, 151L, 182L, 99L, 
210L, 222L, 236L, 133L, 197L, 265L, 117L, 118L, 132L, 118L, 134L, 
271L, 223L, 131L, 132L, 190L, 146L, 220L, 223L, 236L, 197L, 266L, 
234L, 194L, 232L, 235L, 222L, 251L, 252L, 303L, 260L, 274L, 245L, 
145L, 277L, 123L, 224L, 192L, 273L, 145L, 277L, 272L, 273L, 260L, 
272L, 279L, 70L, 201L, 225L, 97L, 65L, 217L, 79L, 201L, 70L, 
204L, 120L, 292L, 79L, 219L, 171L, 238L, 203L, 219L, 106L, 135L, 
97L, 86L, 106L, 152L, 238L, 171L, 225L, 284L, 284L, 292L, 217L, 
247L, 262L, 292L, 160L, 304L), line = c(1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 6L, 13L, 4L, 4L, 4L, 
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 
5L, 5L, 5L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 4L, 13L, 6L, 6L, 6L, 
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 8L, 
8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 13L, 8L, 8L, 8L, 8L, 
8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 9L, 9L, 9L, 
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 11L, 
11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 
11L, 12L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 
13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 
13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 10L, 13L), 
    daily_trips = c(10446, 758, 21846, 16512, 6732, 3583, 158, 
    28143, 8255, 8589, 2435, 11649, 9872, 3955, 19620, 15612, 
    2315, 22780, 4312, 5352, 10200, 2115, 25275, 6992, 121786, 
    38980, 1046, 4352, 119852, 106615, 53609, 35475, 7126, 8832, 
    33089, 27000, 2686, 1049, 4700, 3243, 6820, 25906, 26289, 
    2446, 383, 5535, 13560, 2320, 8046, 11075, 15626, 12646, 
    35912, 45198, 43200, 46175, 44432, 43723, 54595, 21878, 14303, 
    102392, 4123, 9772, 38692, 33275, 15809, 1295, 2600, 1555, 
    32346, 20035, 16329, 16726, 13695, 55923, 39612, 63643, 7200, 
    23220, 23118, 12446, 12378, 7952, 5978, 55923, 20055, 21443, 
    38266, 38592, 68340, 10526, 116718, 21758, 31978, 4506, 23855, 
    31040, 6378, 4060, 1292, 969, 21989, 14555, 71723, 1169, 
    23220, 23118, 11715, 13986, 12446, 12378, 2232, 463, 5620, 
    1749, 7952, 5978, 858, 1440, 8769, 6935, 11169, 22546, 99955, 
    14029, NA, 33503, 3538, 31549, 18272, 13260, 55923, 5020, 
    20055, 21443, 26046, 32343, 116718, 8112, 11158, 5235, 21758, 
    3109, 5923, 7583, 4506, 22058, 37086, 41615, 2040, 23855, 
    31040, 10349, 438, 8715, 6378, 4060, 2443, 9195, 66, 3, NA, 
    NA, 66, 32, 6923, NA, 7929, 969, 55923, 39612, 63643, 7200, 
    21989, 2232, 1475, 5620, 1749, 31549, 55923, 38266, 38592, 
    68340, 4398, 4680, 5738, 6823, 5472, 31978, 7583, 8506, 37086, 
    41615, 7952, 8715, 99966, 5443, 46975, 49898, 124566, 42380, 
    21000, 13258, 18535, 3963, 2452, 4129, 1515, 5283, 16555, 
    183346, 12278, 5646, 6735, 8920, 2538, 6389, 3349, 50498, 
    69, 164952, 16726, 1449, 39612, 65943, 63643, 7200, 432, 
    2632, 3486, 2212, 1660, 11563, 10115, 38266, 38592, 68340, 
    1732, 45212, 28792, 12406, 14783, 8455, 7249, 9032, 31978, 
    7455, 4503, 30975, 9063, 10135, 11286, 32740, 14200, 9506, 
    17083, 71155, 23538, 31386, 39226, 30495, 80203, 54400, 32366, 
    27618, 7003, 15243, 18709, 16686, 8340, 4400, 35595, 79918, 
    38012, 1263, 21846, 14792, 51758, 43015, 56620, 12306, 10409, 
    16446, 12780, 20200, 14546, 28143, 92315, 2386, 109000, 798, 
    7472, 24560, 13803, 6583, 2889, 48929, 52223, 32880, 4252, 
    16515, 7300, 46129, 25798, 4638, 6266, 20086, 27040, 47498, 
    9726, 7949, 12703, 9029, 3120, 6532, 79375, 71723, 21966, 
    20035, 19263, 10589, 10352, 1446, 13772, 10038, 9952, 99955, 
    11563, 10115, 116718, 104895, 30575, 58380, 5018, 3049, 10846, 
    55, 8455, 7249, 24612, 16069, 11532, 19140, 103140, 9032, 
    23720, 96018, 14786, 36655, 25323, 9755, 4312, 7289, 9506, 
    7958, 8023, 28106, 17426, 11838, 20278, 92315, 109000, 86612, 
    30680, 111443, 81980, 93920, 96980, 43238, 51858, 21346, 
    39383, 198560, 952, 849, 8572, 860, 2220, 2409, 1200, 1692, 
    695, 549, 4020, 1080, 1123, 3903, 2912, 3195, 3132, 3266, 
    772, 2140, 1075, 132, 826, NA, 3689, 2700, 3475, 2795, 1952, 
    438, 2798, 986, 480, 458, 43198, 2258), line_name = c("Bakerloo Line", 
    "Bakerloo Line", "Bakerloo Line", "Bakerloo Line", "Bakerloo Line", 
    "Bakerloo Line", "Bakerloo Line", "Bakerloo Line", "Bakerloo Line", 
    "Bakerloo Line", "Bakerloo Line", "Bakerloo Line", "Bakerloo Line", 
    "Bakerloo Line", "Bakerloo Line", "Bakerloo Line", "Bakerloo Line", 
    "Bakerloo Line", "Bakerloo Line", "Bakerloo Line", "Bakerloo Line", 
    "Bakerloo Line", "Bakerloo Line", "Bakerloo Line", "Central Line", 
    "Central Line", "Central Line", "Central Line", "Central Line", 
    "Central Line", "Central Line", "Central Line", "Central Line", 
    "Central Line", "Central Line", "Central Line", "Central Line", 
    "Central Line", "Central Line", "Central Line", "Central Line", 
    "Central Line", "Central Line", "Central Line", "Central Line", 
    "Central Line", "Central Line", "Central Line", "Central Line", 
    "Central Line", "Central Line", "Central Line", "Central Line", 
    "Central Line", "Central Line", "Central Line", "Central Line", 
    "Central Line", "Central Line", "Central Line", "Central Line", 
    "Central Line", "Central Line", "Central Line", "Central Line", 
    "Central Line", "Central Line", "Central Line", "Central Line", 
    "Central Line", "Central Line", "Central Line", "Central Line", 
    "Circle Line", "Circle Line", "Circle Line", "Circle Line", 
    "Circle Line", "Circle Line", "Circle Line", "Circle Line", 
    "Circle Line", "Circle Line", "Circle Line", "Circle Line", 
    "Circle Line", "Circle Line", "Circle Line", "Circle Line", 
    "Circle Line", "Circle Line", "Circle Line", "Circle Line", 
    "Circle Line", "Circle Line", "Circle Line", "Circle Line", 
    "Circle Line", "Circle Line", "Circle Line", "District Line", 
    "District Line", "District Line", "District Line", "District Line", 
    "District Line", "District Line", "District Line", "District Line", 
    "District Line", "District Line", "District Line", "Hammersmith & City Line", 
    "Docklands Light Railway", "District Line", "District Line", 
    "District Line", "District Line", "District Line", "District Line", 
    "District Line", "District Line", "District Line", "District Line", 
    "District Line", "District Line", "District Line", "District Line", 
    "District Line", "District Line", "District Line", "District Line", 
    "District Line", "District Line", "District Line", "District Line", 
    "District Line", "District Line", "District Line", "District Line", 
    "District Line", "District Line", "District Line", "District Line", 
    "District Line", "District Line", "District Line", "District Line", 
    "District Line", "District Line", "District Line", "District Line", 
    "District Line", "District Line", "District Line", "District Line", 
    "District Line", "District Line", "District Line", "District Line", 
    "East London Line", "East London Line", "East London Line", 
    "East London Line", "East London Line", "East London Line", 
    "East London Line", "East London Line", "Hammersmith & City Line", 
    "Hammersmith & City Line", "Hammersmith & City Line", "Hammersmith & City Line", 
    "Hammersmith & City Line", "Hammersmith & City Line", "Hammersmith & City Line", 
    "District Line", "Docklands Light Railway", "Hammersmith & City Line", 
    "Hammersmith & City Line", "Hammersmith & City Line", "Hammersmith & City Line", 
    "Hammersmith & City Line", "Hammersmith & City Line", "Hammersmith & City Line", 
    "Hammersmith & City Line", "Hammersmith & City Line", "Hammersmith & City Line", 
    "Hammersmith & City Line", "Hammersmith & City Line", "Hammersmith & City Line", 
    "Hammersmith & City Line", "Hammersmith & City Line", "Hammersmith & City Line", 
    "Hammersmith & City Line", "Hammersmith & City Line", "Hammersmith & City Line", 
    "Jubilee Line", "Jubilee Line", "Jubilee Line", "Jubilee Line", 
    "Jubilee Line", "Jubilee Line", "Jubilee Line", "Jubilee Line", 
    "Jubilee Line", "Jubilee Line", "Jubilee Line", "Jubilee Line", 
    "Jubilee Line", "Jubilee Line", "Jubilee Line", "Jubilee Line", 
    "Jubilee Line", "Jubilee Line", "Jubilee Line", "Jubilee Line", 
    "Jubilee Line", "Jubilee Line", "Jubilee Line", "Jubilee Line", 
    "Jubilee Line", "Jubilee Line", "Metropolitan Line", "Metropolitan Line", 
    "Metropolitan Line", "Metropolitan Line", "Metropolitan Line", 
    "Metropolitan Line", "Metropolitan Line", "Metropolitan Line", 
    "Metropolitan Line", "Metropolitan Line", "Metropolitan Line", 
    "Metropolitan Line", "Metropolitan Line", "Metropolitan Line", 
    "Metropolitan Line", "Metropolitan Line", "Docklands Light Railway", 
    "Metropolitan Line", "Metropolitan Line", "Metropolitan Line", 
    "Metropolitan Line", "Metropolitan Line", "Metropolitan Line", 
    "Metropolitan Line", "Metropolitan Line", "Metropolitan Line", 
    "Metropolitan Line", "Metropolitan Line", "Metropolitan Line", 
    "Metropolitan Line", "Metropolitan Line", "Metropolitan Line", 
    "Metropolitan Line", "Metropolitan Line", "Northern Line", 
    "Northern Line", "Northern Line", "Northern Line", "Northern Line", 
    "Northern Line", "Northern Line", "Northern Line", "Northern Line", 
    "Northern Line", "Northern Line", "Northern Line", "Northern Line", 
    "Northern Line", "Northern Line", "Northern Line", "Northern Line", 
    "Northern Line", "Northern Line", "Northern Line", "Northern Line", 
    "Northern Line", "Northern Line", "Northern Line", "Northern Line", 
    "Northern Line", "Northern Line", "Northern Line", "Northern Line", 
    "Northern Line", "Northern Line", "Northern Line", "Northern Line", 
    "Northern Line", "Northern Line", "Northern Line", "Northern Line", 
    "Northern Line", "Northern Line", "Northern Line", "Northern Line", 
    "Northern Line", "Northern Line", "Northern Line", "Northern Line", 
    "Northern Line", "Northern Line", "Northern Line", "Northern Line", 
    "Northern Line", "Northern Line", "Piccadilly Line", "Piccadilly Line", 
    "Piccadilly Line", "Piccadilly Line", "Piccadilly Line", 
    "Piccadilly Line", "Piccadilly Line", "Piccadilly Line", 
    "Piccadilly Line", "Piccadilly Line", "Piccadilly Line", 
    "Piccadilly Line", "Piccadilly Line", "Piccadilly Line", 
    "Piccadilly Line", "Piccadilly Line", "Piccadilly Line", 
    "Piccadilly Line", "Piccadilly Line", "Piccadilly Line", 
    "Piccadilly Line", "Piccadilly Line", "Piccadilly Line", 
    "Piccadilly Line", "Piccadilly Line", "Piccadilly Line", 
    "Piccadilly Line", "Piccadilly Line", "Piccadilly Line", 
    "Piccadilly Line", "Piccadilly Line", "Piccadilly Line", 
    "Piccadilly Line", "Piccadilly Line", "Piccadilly Line", 
    "Piccadilly Line", "Piccadilly Line", "Piccadilly Line", 
    "Piccadilly Line", "Piccadilly Line", "Piccadilly Line", 
    "Piccadilly Line", "Piccadilly Line", "Piccadilly Line", 
    "Piccadilly Line", "Piccadilly Line", "Piccadilly Line", 
    "Piccadilly Line", "Piccadilly Line", "Piccadilly Line", 
    "Piccadilly Line", "Victoria Line", "Victoria Line", "Victoria Line", 
    "Victoria Line", "Victoria Line", "Victoria Line", "Victoria Line", 
    "Victoria Line", "Victoria Line", "Victoria Line", "Victoria Line", 
    "Victoria Line", "Victoria Line", "Victoria Line", "Victoria Line", 
    "Waterloo & City Line", "Docklands Light Railway", "Docklands Light Railway", 
    "Docklands Light Railway", "Docklands Light Railway", "Docklands Light Railway", 
    "Docklands Light Railway", "Docklands Light Railway", "Docklands Light Railway", 
    "Docklands Light Railway", "Docklands Light Railway", "Docklands Light Railway", 
    "Docklands Light Railway", "Docklands Light Railway", "Docklands Light Railway", 
    "Docklands Light Railway", "Docklands Light Railway", "Docklands Light Railway", 
    "Docklands Light Railway", "Docklands Light Railway", "Docklands Light Railway", 
    "Docklands Light Railway", "Docklands Light Railway", "Docklands Light Railway", 
    "Docklands Light Railway", "Docklands Light Railway", "Docklands Light Railway", 
    "Docklands Light Railway", "Docklands Light Railway", "Docklands Light Railway", 
    "Docklands Light Railway", "Docklands Light Railway", "Docklands Light Railway", 
    "Docklands Light Railway", "Docklands Light Railway", "Piccadilly Line", 
    "Docklands Light Railway"), colour = c("#ab6612", "#ab6612", 
    "#ab6612", "#ab6612", "#ab6612", "#ab6612", "#ab6612", "#ab6612", 
    "#ab6612", "#ab6612", "#ab6612", "#ab6612", "#ab6612", "#ab6612", 
    "#ab6612", "#ab6612", "#ab6612", "#ab6612", "#ab6612", "#ab6612", 
    "#ab6612", "#ab6612", "#ab6612", "#ab6612", "#df002c", "#df002c", 
    "#df002c", "#df002c", "#df002c", "#df002c", "#df002c", "#df002c", 
    "#df002c", "#df002c", "#df002c", "#df002c", "#df002c", "#df002c", 
    "#df002c", "#df002c", "#df002c", "#df002c", "#df002c", "#df002c", 
    "#df002c", "#df002c", "#df002c", "#df002c", "#df002c", "#df002c", 
    "#df002c", "#df002c", "#df002c", "#df002c", "#df002c", "#df002c", 
    "#df002c", "#df002c", "#df002c", "#df002c", "#df002c", "#df002c", 
    "#df002c", "#df002c", "#df002c", "#df002c", "#df002c", "#df002c", 
    "#df002c", "#df002c", "#df002c", "#df002c", "#df002c", "#f7dc00", 
    "#f7dc00", "#f7dc00", "#f7dc00", "#f7dc00", "#f7dc00", "#f7dc00", 
    "#f7dc00", "#f7dc00", "#f7dc00", "#f7dc00", "#f7dc00", "#f7dc00", 
    "#f7dc00", "#f7dc00", "#f7dc00", "#f7dc00", "#f7dc00", "#f7dc00", 
    "#f7dc00", "#f7dc00", "#f7dc00", "#f7dc00", "#f7dc00", "#f7dc00", 
    "#f7dc00", "#f7dc00", "#0d6928", "#0d6928", "#0d6928", "#0d6928", 
    "#0d6928", "#0d6928", "#0d6928", "#0d6928", "#0d6928", "#0d6928", 
    "#0d6928", "#0d6928", "#f5a6b3", "#00A77E", "#0d6928", "#0d6928", 
    "#0d6928", "#0d6928", "#0d6928", "#0d6928", "#0d6928", "#0d6928", 
    "#0d6928", "#0d6928", "#0d6928", "#0d6928", "#0d6928", "#0d6928", 
    "#0d6928", "#0d6928", "#0d6928", "#0d6928", "#0d6928", "#0d6928", 
    "#0d6928", "#0d6928", "#0d6928", "#0d6928", "#0d6928", "#0d6928", 
    "#0d6928", "#0d6928", "#0d6928", "#0d6928", "#0d6928", "#0d6928", 
    "#0d6928", "#0d6928", "#0d6928", "#0d6928", "#0d6928", "#0d6928", 
    "#0d6928", "#0d6928", "#0d6928", "#0d6928", "#0d6928", "#0d6928", 
    "#0d6928", "#0d6928", "#f3ba22", "#f3ba22", "#f3ba22", "#f3ba22", 
    "#f3ba22", "#f3ba22", "#f3ba22", "#f3ba22", "#f5a6b3", "#f5a6b3", 
    "#f5a6b3", "#f5a6b3", "#f5a6b3", "#f5a6b3", "#f5a6b3", "#0d6928", 
    "#00A77E", "#f5a6b3", "#f5a6b3", "#f5a6b3", "#f5a6b3", "#f5a6b3", 
    "#f5a6b3", "#f5a6b3", "#f5a6b3", "#f5a6b3", "#f5a6b3", "#f5a6b3", 
    "#f5a6b3", "#f5a6b3", "#f5a6b3", "#f5a6b3", "#f5a6b3", "#f5a6b3", 
    "#f5a6b3", "#f5a6b3", "#767b7f", "#767b7f", "#767b7f", "#767b7f", 
    "#767b7f", "#767b7f", "#767b7f", "#767b7f", "#767b7f", "#767b7f", 
    "#767b7f", "#767b7f", "#767b7f", "#767b7f", "#767b7f", "#767b7f", 
    "#767b7f", "#767b7f", "#767b7f", "#767b7f", "#767b7f", "#767b7f", 
    "#767b7f", "#767b7f", "#767b7f", "#767b7f", "#8b004c", "#8b004c", 
    "#8b004c", "#8b004c", "#8b004c", "#8b004c", "#8b004c", "#8b004c", 
    "#8b004c", "#8b004c", "#8b004c", "#8b004c", "#8b004c", "#8b004c", 
    "#8b004c", "#8b004c", "#00A77E", "#8b004c", "#8b004c", "#8b004c", 
    "#8b004c", "#8b004c", "#8b004c", "#8b004c", "#8b004c", "#8b004c", 
    "#8b004c", "#8b004c", "#8b004c", "#8b004c", "#8b004c", "#8b004c", 
    "#8b004c", "#8b004c", "#000000", "#000000", "#000000", "#000000", 
    "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", 
    "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", 
    "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", 
    "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", 
    "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", 
    "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", 
    "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", 
    "#000000", "#000000", "#000000", "#000000", "#000000", "#002d73", 
    "#002d73", "#002d73", "#002d73", "#002d73", "#002d73", "#002d73", 
    "#002d73", "#002d73", "#002d73", "#002d73", "#002d73", "#002d73", 
    "#002d73", "#002d73", "#002d73", "#002d73", "#002d73", "#002d73", 
    "#002d73", "#002d73", "#002d73", "#002d73", "#002d73", "#002d73", 
    "#002d73", "#002d73", "#002d73", "#002d73", "#002d73", "#002d73", 
    "#002d73", "#002d73", "#002d73", "#002d73", "#002d73", "#002d73", 
    "#002d73", "#002d73", "#002d73", "#002d73", "#002d73", "#002d73", 
    "#002d73", "#002d73", "#002d73", "#002d73", "#002d73", "#002d73", 
    "#002d73", "#002d73", "#0076bd", "#0076bd", "#0076bd", "#0076bd", 
    "#0076bd", "#0076bd", "#0076bd", "#0076bd", "#0076bd", "#0076bd", 
    "#0076bd", "#0076bd", "#0076bd", "#0076bd", "#0076bd", "#89cbc1", 
    "#00A77E", "#00A77E", "#00A77E", "#00A77E", "#00A77E", "#00A77E", 
    "#00A77E", "#00A77E", "#00A77E", "#00A77E", "#00A77E", "#00A77E", 
    "#00A77E", "#00A77E", "#00A77E", "#00A77E", "#00A77E", "#00A77E", 
    "#00A77E", "#00A77E", "#00A77E", "#00A77E", "#00A77E", "#00A77E", 
    "#00A77E", "#00A77E", "#00A77E", "#00A77E", "#00A77E", "#00A77E", 
    "#00A77E", "#00A77E", "#00A77E", "#00A77E", "#002d73", "#00A77E"
    )), .Names = c("station1", "station2", "line", "daily_trips", 
"line_name", "colour"), class = c("tbl_df", "tbl", "data.frame"
), row.names = c(NA, -410L))

# stations
stations <- structure(list(id = c(1L, 2L, 3L, 4L, 5L, 7L, 8L, 9L, 10L, 11L, 
12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 24L, 25L, 
26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 36L, 38L, 39L, 40L, 
42L, 44L, 45L, 47L, 48L, 49L, 51L, 52L, 54L, 55L, 56L, 58L, 59L, 
60L, 61L, 63L, 65L, 66L, 67L, 70L, 71L, 72L, 73L, 74L, 75L, 76L, 
77L, 78L, 79L, 80L, 81L, 82L, 83L, 84L, 85L, 87L, 89L, 90L, 91L, 
92L, 93L, 94L, 95L, 96L, 97L, 98L, 99L, 100L, 101L, 102L, 103L, 
104L, 105L, 107L, 108L, 109L, 110L, 111L, 112L, 113L, 114L, 115L, 
116L, 117L, 118L, 119L, 120L, 122L, 123L, 124L, 125L, 126L, 127L, 
128L, 129L, 130L, 131L, 132L, 133L, 134L, 135L, 136L, 137L, 138L, 
139L, 140L, 141L, 142L, 143L, 144L, 145L, 146L, 147L, 148L, 149L, 
150L, 151L, 153L, 154L, 155L, 156L, 157L, 159L, 160L, 161L, 162L, 
163L, 164L, 165L, 166L, 167L, 168L, 169L, 170L, 171L, 172L, 173L, 
176L, 177L, 178L, 179L, 180L, 181L, 182L, 184L, 185L, 186L, 188L, 
190L, 191L, 192L, 193L, 194L, 195L, 196L, 197L, 198L, 199L, 200L, 
201L, 202L, 203L, 205L, 206L, 207L, 208L, 209L, 210L, 211L, 212L, 
213L, 215L, 216L, 217L, 218L, 219L, 220L, 222L, 223L, 224L, 225L, 
226L, 227L, 228L, 229L, 230L, 231L, 234L, 235L, 236L, 237L, 238L, 
239L, 240L, 241L, 242L, 243L, 244L, 245L, 246L, 247L, 248L, 249L, 
250L, 251L, 252L, 253L, 254L, 255L, 257L, 258L, 259L, 260L, 262L, 
263L, 264L, 265L, 266L, 267L, 268L, 269L, 270L, 271L, 272L, 273L, 
274L, 275L, 276L, 277L, 278L, 279L, 281L, 282L, 283L, 284L, 285L, 
286L, 287L, 288L, 289L, 290L, 291L, 292L, 293L, 294L, 295L, 296L, 
297L, 298L, 299L, 300L, 301L, 302L, 303L, 35L, 6L, 23L, 50L, 
46L, 53L, 214L, 62L, 280L, 221L, 121L, 261L, 57L, 187L, 232L, 
88L, 256L, 68L, 158L, 37L, 204L, 233L, 41L, 43L, 183L, 64L, 106L, 
69L, 86L, 152L, 174L, 175L, 304L, 307L, 305L, 306L), latitude = c(51.5028, 
51.5143, 51.5154, 51.5107, 51.5407, 51.5322, 51.5653, 51.6164, 
51.5586, 51.5226, 51.4431, 51.5133, 51.5204, 51.5396, 51.5856, 
51.4905, 51.5121, 51.5148, 51.5087, 51.5403, 51.5504, 51.527, 
51.512, 51.5867, 51.5079, 51.5142, 51.5011, 51.4956, 51.6071, 
51.5273, 51.5269, 51.5766, 51.5248, 51.6028, 51.5481, 51.5392, 
51.5051, 51.5113, 51.6078, 51.5441, 51.5185, 51.508, 51.6177, 
51.4946, 51.4618, 51.4649, 51.4527, 51.5955, 51.418, 51.5129, 
51.4957, 51.5095, 51.5085, 51.5443, 51.5417, 51.5223, 51.552, 
51.5152, 51.5101, 51.492, 51.5765, 51.5168, 51.5874, 51.5394, 
51.5093, 51.4586, 51.6137, 51.5199, 51.5203, 51.4943, 51.5496, 
51.5074, 51.5282, 51.526, 51.596, 51.5203, 51.6012, 51.5472, 
51.5642, 51.4804, 51.5096, 51.5765, 51.4945, 51.5724, 51.5018, 
51.5205, 51.6132, 51.5238, 51.5423, 51.5067, 51.4915, 51.603, 
51.4936, 51.5568, 51.5302, 51.5362, 51.5925, 51.5793, 51.4669, 
51.4713, 51.4598, 51.5829, 51.5033, 51.5009, 51.546, 51.5777, 
51.5538, 51.5174, 51.5075, 51.5526, 51.5539, 51.4713, 51.4733, 
51.4734, 51.5027, 51.5619, 51.4871, 51.4884, 51.5304, 51.4983, 
51.5507, 51.5816, 51.477, 51.5471, 51.5351, 51.5846, 51.5308, 
51.5015, 51.5172, 51.4991, 51.5119, 51.5139, 51.5113, 51.5566, 
51.5683, 51.5123, 51.5178, 51.5052, 51.53, 51.5712, 51.5122, 
51.5136, 51.5225, 51.5249, 51.6082, 51.5108, 51.5186, 51.6294, 
51.4022, 51.5342, 51.4902, 51.5542, 51.5756, 51.4995, 51.5483, 
51.5784, 51.6111, 51.6004, 51.5237, 51.5175, 51.5846, 51.5621, 
51.5094, 51.5263, 51.4813, 51.4819, 51.515, 51.5154, 51.527, 
51.4753, 51.5366, 51.5098, 51.4893, 51.5926, 51.5313, 51.5077, 
51.572, 51.5093, 51.4682, 51.5341, 51.5942, 51.5107, 51.4942, 
51.5753, 51.5763, 51.5234, 51.4633, 51.6171, 51.501, 51.5084, 
51.519, 51.5091, 51.5715, 51.5732, 51.523, 51.5822, 51.5117, 
51.5046, 51.5058, 51.5227, 51.4924, 51.5808, 51.4454, 51.5011, 
51.5646, 51.4941, 51.5701, 51.5007, 51.5569, 51.4154, 51.5917, 
51.495, 51.6194, 51.5221, 51.4723, 51.5439, 51.5416, 51.4994, 
51.5347, 51.5146, 51.5569, 51.5507, 51.4933, 51.5432, 51.5111, 
51.4361, 51.4275, 51.5165, 51.5882, 51.5106, 51.5098, 51.5567, 
51.4951, 51.5904, 51.559, 51.5582, 51.5385, 51.5352, 51.5463, 
51.4861, 51.4965, 51.583, 51.5775, 51.5043, 51.5247, 51.5235, 
51.5036, 51.5519, 51.5635, 51.521, 51.5097, 51.501, 51.518, 51.4872, 
51.6095, 51.5287, 51.5469, 51.5795, 51.507, 51.4907, 51.5696, 
51.5194, 51.512, 51.5492, 51.5326, 51.4214, 51.4343, 51.607, 
51.6179, 51.5975, 51.4627, 51.6736, 51.4979, 51.7052, 51.6679, 
51.6543, 51.6404, 51.647, 51.6573, 51.5606, 51.6503, 51.6302, 
51.6517, 51.6476, 51.6322, 51.6937, 51.6717, 51.6455, 51.6412, 
51.6266, 51.5343, 51.504, 51.4982, 51.5147, 51.5005, 51.4827, 
51.4781, 51.474, 51.4693, 51.4657, 51.4767, 51.4757, 51.5027, 
51.502, 51.5021, 51.5037), longitude = c(-0.2801, -0.0755, -0.0726, 
-0.013, -0.2997, -0.1058, -0.1353, -0.1331, -0.1059, -0.1571, 
-0.1525, -0.0886, -0.0979, 0.081, 0.0887, -0.2139, -0.1879, 0.0613, 
0.055, 0.127, -0.1642, -0.0549, -0.1031, -0.0417, -0.0066, -0.1494, 
-0.0943, -0.325, -0.1243, -0.0208, -0.0247, -0.2136, -0.0119, 
-0.2641, -0.1188, -0.1426, -0.0209, -0.0904, -0.2947, -0.1538, 
-0.1111, -0.1247, 0.0755, -0.2678, -0.1384, -0.1299, -0.148, 
-0.2502, -0.1778, -0.1243, -0.0144, 0.0276, 0.064, 0.1655, 0.1469, 
-0.0173, -0.2387, -0.3017, -0.2882, -0.1973, -0.397, -0.2474, 
-0.165, 0.0518, -0.0021, -0.2112, -0.275, -0.1679, -0.17, -0.1001, 
0.1977, -0.1223, -0.1337, -0.1359, 0.0912, -0.1053, -0.1932, 
-0.1803, -0.1065, -0.195, 0.0716, 0.0663, -0.1829, -0.1941, -0.2267, 
-0.1347, 0.0923, -0.1439, -0.3456, -0.1428, -0.2754, 0.0933, 
-0.2251, -0.178, -0.2933, -0.2575, -0.3351, -0.3366, -0.4227, 
-0.4524, -0.4476, -0.2259, -0.0215, -0.1925, -0.104, -0.1458, 
-0.4499, -0.12, -0.206, -0.1132, 0.2184, -0.3665, -0.3564, -0.3855, 
-0.1527, -0.4421, -0.0101, -0.1053, -0.225, -0.2106, -0.1402, 
-0.3162, -0.285, -0.2047, -0.1939, -0.2786, -0.1238, -0.1607, 
-0.2107, -0.1115, -0.1756, -0.2172, -0.1281, -0.0053, 0.0083, 
-0.0396, -0.0823, -0.0864, -0.1854, -0.0958, -0.094, -0.1586, 
-0.1631, -0.0332, -0.2103, -0.0863, -0.0886, -0.432, -0.1948, 
-0.1387, -0.0145, -0.2503, 0.0899, -0.3142, -0.3687, -0.3184, 
-0.424, -0.4092, -0.2597, -0.2887, -0.3626, -0.3034, -0.1967, 
-0.0873, -0.3522, -0.113, -0.1415, -0.1755, -0.2841, -0.2011, 
-0.3232, -0.1342, -0.1334, -0.3805, 0.0172, -0.0173, -0.2954, 
0.0336, -0.2089, -0.2047, -0.2861, -0.1877, -0.2359, -0.3714, 
0.0454, -0.1466, -0.3013, 0.0439, -0.0525, 0.0465, -0.188, 0.0181, 
-0.4213, -0.4125, -0.1244, -0.0749, -0.056, -0.2187, -0.2265, 
-0.0708, -0.1565, 0.0216, -0.2066, -0.3072, -0.3521, -0.1738, 
-0.3081, -0.0191, -0.3988, -0.1919, 0.0275, -0.2459, -0.3028, 
-0.047, -0.123, -0.2759, -0.0042, -0.1335, -0.174, -0.0973, -0.3366, 
-0.3156, -0.0478, -0.1738, -0.1141, -0.1598, -0.168, -0.131, 
-0.0594, -0.0743, -0.0766, -0.1374, -0.2547, -0.1028, 0.251, 
0.2343, 0.1014, 0.0343, -0.4786, -0.1253, -0.1447, -0.0195, 0.0288, 
-0.0558, -0.1384, -0.1835, -0.1143, -0.2963, -0.2795, -0.2011, 
-0.0265, -0.1254, -0.2809, -0.1953, -0.1883, 0.0056, -0.1906, 
-0.3533, -0.0203, -0.2065, -0.4376, -0.0612, -0.2239, -0.2215, 
-0.2478, -0.2064, -0.1992, 0.0341, -0.1856, -0.1097, -0.1145, 
-0.607, -0.0637, -0.611, -0.561, -0.5183, -0.4733, -0.4412, -0.4177, 
-0.4103, -0.1943, -0.1791, -0.1496, -0.1318, -0.128, 0.1139, 
0.1033, 0.0838, 0.0558, 0.0471, -0.0139, -0.1052, -0.0502, 0.0082, 
0.0039, -0.0096, -0.0149, -0.0216, -0.0174, -0.0142, -0.0327, 
-0.0402, 0.0226, 0.0627, 0.0319, 0.0488), name = c("Acton Town", 
"Aldgate", "Aldgate East", "All Saints", "Alperton", "Angel", 
"Archway", "Arnos Grove", "Arsenal", "Baker Street", "Balham", 
"Bank", "Barbican", "Barking", "Barkingside", "Barons Court", 
"Bayswater", "Beckton", "Beckton Park", "Becontree", "Belsize Park", 
"Bethnal Green", "Blackfriars", "Blackhorse Road", "Blackwall", 
"Bond Street", "Borough", "Boston Manor", "Bounds Green", "Bow Church", 
"Bow Road", "Brent Cross", "Bromley-By-Bow", "Burnt Oak", "Caledonian Road", 
"Camden Town", "Canary Wharf", "Cannon Street", "Canons Park", 
"Chalk Farm", "Chancery Lane", "Charing Cross", "Chigwell", "Chiswick Park", 
"Clapham Common", "Clapham North", "Clapham South", "Colindale", 
"Colliers Wood", "Covent Garden", "Crossharbour & London Arena", 
"Custom House", "Cyprus", "Dagenham East", "Dagenham Heathway", 
"Devons Road", "Dollis Hill", "Ealing Broadway", "Ealing Common", 
"Earl's Court", "Eastcote", "East Acton", "East Finchley", "East Ham", 
"East India", "East Putney", "Edgware", "Edgware Road (B)", "Edgware Road (C)", 
"Elephant & Castle", "Elm Park", "Embankment", "Euston", "Euston Square", 
"Fairlop", "Farringdon", "Finchley Central", "Finchley Road", 
"Finsbury Park", "Fulham Broadway", "Gallions Reach", "Gants Hill", 
"Gloucester Road", "Golders Green", "Goldhawk Road", "Goodge Street", 
"Grange Hill", "Great Portland Street", "Greenford", "Green Park", 
"Gunnersbury", "Hainault", "Hammersmith", "Hampstead", "Hanger Lane", 
"Harlesden", "Harrow & Wealdston", "Harrow-on-the-Hill", "Hatton Cross", 
"Heathrow Terminals 1, 2 & 3", "Heathrow Terminal 4", "Hendon Central", 
"Heron Quays", "High Street Kensington", "Highbury & Islington", 
"Highgate", "Hillingdon", "Holborn", "Holland Park", "Holloway Road", 
"Hornchurch", "Hounslow Central", "Hounslow East", "Hounslow West", 
"Hyde Park Corner", "Ickenham", "Island Gardens", "Kennington", 
"Kensal Green", "Kensington (Olympia)", "Kentish Town", "Kenton", 
"Kew Gardens", "Kilburn", "Kilburn Park", "Kingsbury", "King's Cross St. Pancras", 
"Knightsbridge", "Ladbroke Grove", "Lambeth North", "Lancaster Gate", 
"Latimer Road", "Leicester Square", "Leyton", "Leytonstone", 
"Limehouse", "Liverpool Street", "London Bridge", "Maida Vale", 
"Manor House", "Mansion House", "Marble Arch", "Marylebone", 
"Mile End", "Mill Hill East", "Monument", "Moorgate", "Moor Park", 
"Morden", "Mornington Crescent", "Mudchute", "Neasden", "Newbury Park", 
"Northfields", "Northolt", "Northwick Park", "Northwood", "Northwood Hills", 
"North Acton", "North Ealing", "North Harrow", "North Wembley", 
"Notting Hill Gate", "Old Street", "Osterley", "Oval", "Oxford Circus", 
"Paddington", "Park Royal", "Parsons Green", "Perivale", "Picadilly Circus", 
"Pimlico", "Pinner", "Plaistow", "Poplar", "Preston Road", "Prince Regent", 
"Putney Bridge", "Queen's Park", "Queensbury", "Queensway", "Ravenscourt Park", 
"Rayners Lane", "Redbridge", "Regent's Park", "Richmond", "Roding Valley", 
"Rotherhithe", "Royal Albert", "Royal Oak", "Royal Victoria", 
"Ruislip", "Ruislip Manor", "Russell Square", "Seven Sisters", 
"Shadwell", "Shepherd's Bush (C)", "Shepherd's Bush (H)", "Shoreditch", 
"Sloane Square", "Snaresbrook", "Southfields", "South Ealing", 
"South Harrow", "South Kensington", "South Kenton", "South Quay", 
"South Ruislip", "South Wimbledon", "South Woodford", "Stamford Brook", 
"Stanmore", "Stepney Green", "Stockwell", "Stonebridge Park", 
"Stratford", "St. James's Park", "St. John's Wood", "St. Paul's", 
"Sudbury Hill", "Sudbury Town", "Surrey Quays", "Swiss Cottage", 
"Temple", "Tooting Bec", "Tooting Broadway", "Tottenham Court Road", 
"Tottenham Hale", "Tower Gateway", "Tower Hill", "Tufnell Park", 
"Turnham Green", "Turnpike Lane", "Upminster", "Upminster Bridge", 
"Upney", "Upton Park", "Uxbridge", "Vauxhall", "Victoria", "Walthamstow Central", 
"Wanstead", "Wapping", "Warren Street", "Warwick Avenue", "Waterloo", 
"Wembley Central", "Wembley Park", "Westbourne Park", "Westferry", 
"Westminster", "West Acton", "West Brompton", "West Finchley", 
"West Ham", "West Hampstead", "West Harrow", "West India Quay", 
"West Kensington", "West Ruislip", "Whitechapel", "White City", 
"Willesden Green", "Willesden Junction", "Wimbledon", "Wimbledon Park", 
"Woodford", "Woodside Park", "Wood Green", "Brixton", "Amersham", 
"Bermondsey", "Chesham", "Chalfont & Latimer", "Chorleywood", 
"Rickmansworth", "Croxley", "Watford", "Ruislip Gardens", "High Barnet", 
"Totteridge & Whetstone", "Cockfosters", "Oakwood", "Southgate", 
"Epping", "Theydon Bois", "Debden", "Loughton", "Buckhurst Hill", 
"Pudding Mill Lane", "Southwark", "Canada Water", "Canning Town", 
"North Greenwich", "Cutty Sark", "Greenwich", "Deptford Bridge", 
"Elverson Road", "Lewisham", "New Cross", "New Cross Gate", "West Silvertown", 
"King George V", "Pontoon Dock", "London City Airport"), display_name = c("Acton<br />Town", 
"NULL", "Aldgate<br />East", "All<br />Saints", "NULL", "NULL", 
"NULL", "Arnos<br />Grove", "NULL", "Baker<br />Street", "NULL", 
"NULL", "NULL", "NULL", "NULL", "Barons<br />Court", "NULL", 
"NULL", "Beckton<br />Park", "NULL", "Belsize<br />Park", "Bethnal<br />Green", 
"NULL", "Blackhorse<br />Road", "NULL", "Bond<br />Street", "NULL", 
"Boston<br />Manor", "Bounds<br />Green", "Bow<br />Church", 
"Bow<br />Road", "Brent<br />Cross", "NULL", "Burnt<br />Oak", 
"Caledonian<br />Road", "Camden<br />Town", "Canary<br />Wharf", 
"Cannon<br />Street", "Canons<br />Park", "Chalk<br />Farm", 
"Chancery<br />Lane", "Charing<br />Cross", "NULL", "Chiswick<br />Park", 
"Clapham<br />Common", "Clapham<br />North", "Clapham<br />South", 
"NULL", "Colliers<br />Wood", "Covent<br />Garden", "Crossharbour &<br />London Arena", 
"Custom<br />House", "NULL", "Dagenham<br />East", "Dagenham<br />Heathway", 
"Devons<br />Road", "Dollis<br />Hill", "Ealing<br />Broadway", 
"Ealing<br />Common", "Earl's<br />Court", "NULL", "East<br />Acton", 
"East<br />Finchley", "East<br />Ham", "East<br />India", "East<br />Putney", 
"NULL", "Edgware<br />Road", "Edgware<br />Road", "Elephant &<br />Castle", 
"Elm<br />Park", "NULL", "NULL", "Euston<br />Square", "NULL", 
"NULL", "Finchley<br />Central", "Finchley<br />Road", "Finsbury<br />Park", 
"Fulham<br />Broadway", "Gallions<br />Reach", "Gants<br />Hill", 
"Gloucester<br />Road", "Golders<br />Green", "Goldhawk<br />Road", 
"Goodge<br />Street", "Grange<br />Hill", "Great<br />Portland<br />Street", 
"NULL", "Green<br />Park", "NULL", "NULL", "NULL", "NULL", "Hanger<br />Lane", 
"NULL", "Harrow &<br />Wealdston", "Harrow-<br />on-the-Hill", 
"Hatton<br />Cross", "Heathrow<br />Terminals<br />1, 2 & 3", 
"Heathrow<br />Terminal 4", "Hendon<br />Central", "Heron<br />Quays", 
"High<br />Street<br />Kensington", "Highbury &<br />Islington", 
"NULL", "NULL", "NULL", "Holland<br />Park", "Holloway<br />Road", 
"NULL", "Hounslow<br />Central", "Hounslow<br />East", "Hounslow<br />West", 
"Hyde<br />Park<br />Corner", "NULL", "Island<br />Gardens", 
"NULL", "Kensal<br />Green", "Kensington<br />(Olympia)", "Kentish<br />Town", 
"NULL", "Kew<br />Gardens", "NULL", "Kilburn<br />Park", "NULL", 
"King's Cross<br />St. Pancras", "NULL", "Ladbroke<br />Grove", 
"Lambeth<br />North", "Lancaster<br />Gate", "Latimer<br />Road", 
"Leicester<br />Square", "NULL", "NULL", "NULL", "Liverpool<br />Street", 
"London<br />Bridge", "Maida<br />Vale", "Manor<br />House", 
"Mansion<br />House", "Marble<br />Arch", "NULL", "Mile<br />End", 
"Mill<br />Hill<br />East", "NULL", "NULL", "Moor<br />Park", 
"NULL", "Mornington<br />Crescent", "NULL", "NULL", "Newbury<br />Park", 
"NULL", "NULL", "Northwick<br />Park", "NULL", "Northwood<br />Hills", 
"North<br />Acton", "North<br />Ealing", "North<br />Harrow", 
"North<br />Wembley", "Notting<br />Hill Gate", "Old<br />Street", 
"NULL", "NULL", "Oxford<br />Circus", "NULL", "Park<br />Royal", 
"Parsons<br />Green", "NULL", "Picadilly<br />Circus", "NULL", 
"NULL", "NULL", "NULL", "Preston<br />Road", "Prince<br />Regent", 
"Putney<br />Bridge", "Queens<br />Park", "NULL", "NULL", "Ravenscourt<br />Park", 
"Rayners<br />Lane", "NULL", "Regent's<br />Park", "NULL", "Roding<br />Valley", 
"NULL", "Royal<br />Albert", "Royal<br />Oak", "Royal<br />Victoria", 
"NULL", "Ruislip<br />Manor", "Russell<br />Square", "Seven<br />Sisters", 
"NULL", "Shepherd's<br />Bush", "Shepherd's<br />Bush", "NULL", 
"Sloane<br />Square", "NULL", "NULL", "South<br />Ealing", "South<br />Harrow", 
"South<br />Kensington", "South<br />Kenton", "South<br />Quay", 
"South<br />Ruislip", "South<br />Wimbledon", "South<br />Woodford", 
"Stamford<br />Brook", "NULL", "Stepney<br />Green", "NULL", 
"Stonebridge<br />Park", "NULL", "St. James's<br />Park", "St. John's<br />Wood", 
"St. Paul's", "Sudbury<br />Hill", "Sudbury<br />Town", "Surrey<br />Quays", 
"Swiss<br />Cottage", "NULL", "Tooting<br />Bec", "Tooting<br />Broadway", 
"Tottenham<br />Court<br />Road", "Tottenham<br />Hale", "Tower<br />Gateway", 
"Tower<br />Hill", "Tufnell<br />Park", "Turnham<br />Green", 
"Turnpike<br />Lane", "NULL", "Upminster<br />Bridge", "NULL", 
"Upton<br />Park", "NULL", "NULL", "NULL", "Walthamstow<br />Central", 
"NULL", "NULL", "Warren<br />Street", "Warwick<br />Avenue", 
"NULL", "Wembley<br />Central", "Wembley<br />Park", "Westbourne<br />Park", 
"NULL", "NULL", "West<br />Acton", "West<br />Brompton", "West<br />Finchley", 
"West<br />Ham", "West<br />Hampstead", "West<br />Harrow", "West<br />India<br />Quay", 
"West<br />Kensington", "West<br />Ruislip", "NULL", "White<br />City", 
"Willesden<br />Green", "Willesden<br />Junction", "NULL", "Wimbledon<br />Park", 
"NULL", "Woodside<br />Park", "Wood<br />Green", "NULL", "NULL", 
"NULL", "NULL", "Chalfont &<br />Latimer", "NULL", "NULL", "NULL", 
"NULL", "Ruislip<br />Gardens", "High<br />Barnet", "Totteridge<br />& Whetstone", 
"NULL", "NULL", "NULL", "NULL", "Theydon<br />Bois", "NULL", 
"NULL", "Buckhurst<br />Hill", "Pudding<br />Mill Lane", "NULL", 
"Canada<br />Water", "Canning<br />Town", "North<br />Greenwich", 
"Cutty<br />Sark", "NULL", "Deptford<br />Bridge", "Elverson<br />Road", 
"NULL", "New<br />Cross", "New<br />Cross<br />Gate", "West<br />Silvertown", 
"King<br />George V", "Pontoon<br />Dock", "London<br />City<br />Airport"
), zone = c(3, 1, 1, 2, 4, 1, 2.5, 4, 2, 1, 3, 1, 1, 4, 5, 2, 
1, 3, 3, 5, 2, 2, 1, 3, 2, 1, 1, 4, 3.5, 2, 2, 3, 2.5, 4, 2, 
2, 2, 1, 5, 2, 1, 1, 5, 3, 2, 2, 2.5, 4, 3, 1, 2, 3, 3, 5, 5, 
2, 3, 3, 3, 1.5, 5, 2, 3, 3.5, 2.5, 2.5, 5, 1, 1, 1.5, 6, 1, 
1, 1, 5, 1, 4, 2, 2, 2, 3, 4, 1, 3, 2, 1, 5, 1, 4, 1, 3, 5, 2, 
2.5, 3, 3, 5, 5, 5.5, 6, 6, 3.5, 2, 1, 2, 3, 6, 1, 2, 2, 6, 4, 
4, 5, 1, 6, 2, 2, 2, 2, 2, 4, 3.5, 2, 2, 4, 1, 1, 2, 1, 1, 2, 
1, 3, 3.5, 2, 1, 1, 2, 2.5, 1, 1, 1, 2, 4, 1, 1, 6.5, 4, 2, 2, 
3, 4, 3, 5, 4, 6, 6, 2.5, 3, 5, 4, 1.5, 1, 4, 2, 1, 1, 3, 2, 
4, 1, 1, 5, 3, 2, 4, 3, 2, 2, 4, 1, 2, 5, 4, 1, 4, 5, 2, 3, 2, 
3, 6, 6, 1, 3, 2, 2, 2, 2, 1, 4, 3, 3, 5, 1, 4, 2, 5, 3.5, 4, 
2, 5, 2, 2, 3, 3, 1, 2, 1, 4, 4, 2, 2, 1, 3, 3, 1, 3, 1, 1, 2, 
2.5, 3, 6, 6, 4, 3, 6, 1.5, 1, 3, 4, 2, 1, 2, 1, 4, 4, 2, 2, 
1, 3, 2, 4, 3, 2, 5, 2, 2, 6, 2, 2, 2.5, 3, 3, 3, 4, 4, 3, 2, 
10, 2, 10, 9, 8, 7, 7, 8, 5, 5, 4, 5, 5, 4, 6, 6, 6, 6, 5, 2.5, 
1, 2, 3, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2, 2, 3, 3, 3, 3), total_lines = c(2L, 
2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 5L, 1L, 4L, 3L, 2L, 1L, 2L, 2L, 
1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 
1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 2L, 1L, 
1L, 1L, 1L, 3L, 2L, 1L, 4L, 2L, 3L, 1L, 3L, 1L, 2L, 1L, 1L, 1L, 
1L, 3L, 1L, 1L, 1L, 1L, 3L, 1L, 3L, 1L, 1L, 3L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 6L, 1L, 1L, 
1L, 1L, 1L, 2L, 1L, 1L, 1L, 4L, 2L, 1L, 1L, 2L, 1L, 1L, 3L, 1L, 
2L, 4L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 3L, 1L, 1L, 1L, 3L, 4L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 
2L, 1L, 1L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 3L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 2L, 2L, 1L, 3L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 
1L, 1L, 2L, 1L, 1L, 2L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 3L, 
1L, 1L, 1L, 2L, 1L, 4L, 1L, 2L, 1L, 1L, 3L, 1L, 1L, 1L, 3L, 1L, 
1L, 1L, 1L, 1L, 3L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L), rail = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 
0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 1L, 
0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 0L, 0L, 0L, 
0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 0L, 0L, 
0L, 0L, 1L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 
0L, 0L, 0L, 1L, 1L, 1L, 0L, 0L, 0L, 0L, 1L, 1L, 0L, 0L, 0L, 0L, 
0L, 1L, 0L, 1L, 1L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 1L, 1L, 0L, 0L, 
0L, 0L, 1L, 1L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 1L, 
1L, 1L, 0L, 0L, 0L, 0L), name_cln = c("acton town", "aldgate", 
"aldgate east", "all saints", "alperton", "angel", "archway", 
"arnos grove", "arsenal", "baker street", "balham", "bank", "barbican", 
"barking", "barkingside", "barons court", "bayswater", "beckton", 
"beckton park", "becontree", "belsize park", "bethnal green", 
"blackfriars", "blackhorse road", "blackwall", "bond street", 
"borough", "boston manor", "bounds green", "bow church", "bow road", 
"brent cross", "bromley-by-bow", "burnt oak", "caledonian road", 
"camden town", "canary wharf", "cannon street", "canons park", 
"chalk farm", "chancery lane", "charing cross", "chigwell", "chiswick park", 
"clapham common", "clapham north", "clapham south", "colindale", 
"colliers wood", "covent garden", "crossharbour & london arena", 
"custom house", "cyprus", "dagenham east", "dagenham heathway", 
"devons road", "dollis hill", "ealing broadway", "ealing common", 
"earl's court", "eastcote", "east acton", "east finchley", "east ham", 
"east india", "east putney", "edgware", "edgware road (b)", "edgware road (c)", 
"elephant & castle", "elm park", "embankment", "euston", "euston square", 
"fairlop", "farringdon", "finchley central", "finchley road", 
"finsbury park", "fulham broadway", "gallions reach", "gants hill", 
"gloucester road", "golders green", "goldhawk road", "goodge street", 
"grange hill", "great portland street", "greenford", "green park", 
"gunnersbury", "hainault", "hammersmith", "hampstead", "hanger lane", 
"harlesden", "harrow & wealdston", "harrow-on-the-hill", "hatton cross", 
"heathrow terminals 1, 2 & 3", "heathrow terminal 4", "hendon central", 
"heron quays", "high street kensington", "highbury & islington", 
"highgate", "hillingdon", "holborn", "holland park", "holloway road", 
"hornchurch", "hounslow central", "hounslow east", "hounslow west", 
"hyde park corner", "ickenham", "island gardens", "kennington", 
"kensal green", "kensington (olympia)", "kentish town", "kenton", 
"kew gardens", "kilburn", "kilburn park", "kingsbury", "king's cross st. pancras", 
"knightsbridge", "ladbroke grove", "lambeth north", "lancaster gate", 
"latimer road", "leicester square", "leyton", "leytonstone", 
"limehouse", "liverpool street", "london bridge", "maida vale", 
"manor house", "mansion house", "marble arch", "marylebone", 
"mile end", "mill hill east", "monument", "moorgate", "moor park", 
"morden", "mornington crescent", "mudchute", "neasden", "newbury park", 
"northfields", "northolt", "northwick park", "northwood", "northwood hills", 
"north acton", "north ealing", "north harrow", "north wembley", 
"notting hill gate", "old street", "osterley", "oval", "oxford circus", 
"paddington", "park royal", "parsons green", "perivale", "picadilly circus", 
"pimlico", "pinner", "plaistow", "poplar", "preston road", "prince regent", 
"putney bridge", "queen's park", "queensbury", "queensway", "ravenscourt park", 
"rayners lane", "redbridge", "regent's park", "richmond", "roding valley", 
"rotherhithe", "royal albert", "royal oak", "royal victoria", 
"ruislip", "ruislip manor", "russell square", "seven sisters", 
"shadwell", "shepherd's bush (c)", "shepherd's bush (h)", "shoreditch", 
"sloane square", "snaresbrook", "southfields", "south ealing", 
"south harrow", "south kensington", "south kenton", "south quay", 
"south ruislip", "south wimbledon", "south woodford", "stamford brook", 
"stanmore", "stepney green", "stockwell", "stonebridge park", 
"stratford", "st. james's park", "st. john's wood", "st. paul's", 
"sudbury hill", "sudbury town", "surrey quays", "swiss cottage", 
"temple", "tooting bec", "tooting broadway", "tottenham court road", 
"tottenham hale", "tower gateway", "tower hill", "tufnell park", 
"turnham green", "turnpike lane", "upminster", "upminster bridge", 
"upney", "upton park", "uxbridge", "vauxhall", "victoria", "walthamstow central", 
"wanstead", "wapping", "warren street", "warwick avenue", "waterloo", 
"wembley central", "wembley park", "westbourne park", "westferry", 
"westminster", "west acton", "west brompton", "west finchley", 
"west ham", "west hampstead", "west harrow", "west india quay", 
"west kensington", "west ruislip", "whitechapel", "white city", 
"willesden green", "willesden junction", "wimbledon", "wimbledon park", 
"woodford", "woodside park", "wood green", "brixton", "amersham", 
"bermondsey", "chesham", "chalfont & latimer", "chorleywood", 
"rickmansworth", "croxley", "watford", "ruislip gardens", "high barnet", 
"totteridge & whetstone", "cockfosters", "oakwood", "southgate", 
"epping", "theydon bois", "debden", "loughton", "buckhurst hill", 
"pudding mill lane", "southwark", "canada water", "canning town", 
"north greenwich", "cutty sark", "greenwich", "deptford bridge", 
"elverson road", "lewisham", "new cross", "new cross gate", "west silvertown", 
"king george v", "pontoon dock", "london city airport"), zone_cln = c(3, 
1, 1, 2, 4, 1, 3, 4, 2, 1, 3, 1, 1, 4, 5, 2, 1, 3, 3, 5, 2, 2, 
1, 3, 2, 1, 1, 4, 4, 2, 2, 3, 3, 4, 2, 2, 2, 1, 5, 2, 1, 1, 5, 
3, 2, 2, 3, 4, 3, 1, 2, 3, 3, 5, 5, 2, 3, 3, 3, 2, 5, 2, 3, 4, 
3, 3, 5, 1, 1, 2, 6, 1, 1, 1, 5, 1, 4, 2, 2, 2, 3, 4, 1, 3, 2, 
1, 5, 1, 4, 1, 3, 5, 2, 3, 3, 3, 5, 5, 6, 6, 6, 4, 2, 1, 2, 3, 
6, 1, 2, 2, 6, 4, 4, 5, 1, 6, 2, 2, 2, 2, 2, 4, 4, 2, 2, 4, 1, 
1, 2, 1, 1, 2, 1, 3, 4, 2, 1, 1, 2, 3, 1, 1, 1, 2, 4, 1, 1, 7, 
4, 2, 2, 3, 4, 3, 5, 4, 6, 6, 3, 3, 5, 4, 2, 1, 4, 2, 1, 1, 3, 
2, 4, 1, 1, 5, 3, 2, 4, 3, 2, 2, 4, 1, 2, 5, 4, 1, 4, 5, 2, 3, 
2, 3, 6, 6, 1, 3, 2, 2, 2, 2, 1, 4, 3, 3, 5, 1, 4, 2, 5, 4, 4, 
2, 5, 2, 2, 3, 3, 1, 2, 1, 4, 4, 2, 2, 1, 3, 3, 1, 3, 1, 1, 2, 
3, 3, 6, 6, 4, 3, 6, 2, 1, 3, 4, 2, 1, 2, 1, 4, 4, 2, 2, 1, 3, 
2, 4, 3, 2, 5, 2, 2, 6, 2, 2, 3, 3, 3, 3, 4, 4, 3, 2, 10, 2, 
10, 9, 8, 7, 7, 8, 5, 5, 4, 5, 5, 4, 6, 6, 6, 6, 5, 3, 1, 2, 
3, 3, 3, 3, 3, 3, 3, 2, 2, 3, 3, 3, 3)), .Names = c("id", "latitude", 
"longitude", "name", "display_name", "zone", "total_lines", "rail", 
"name_cln", "zone_cln"), class = c("tbl_df", "tbl", "data.frame"
), row.names = c(NA, -306L))

# lines
lines <- structure(list(line = c(1L, 3L, 6L, 7L, 11L, 2L, 4L, 5L, 8L, 
9L, 10L, 12L, 13L), name = c("Bakerloo Line", "Circle Line", 
"Hammersmith & City Line", "Jubilee Line", "Victoria Line", "Central Line", 
"District Line", "East London Line", "Metropolitan Line", "Northern Line", 
"Piccadilly Line", "Waterloo & City Line", "Docklands Light Railway"
), colour = c("ab6612", "f7dc00", "f5a6b3", "767b7f", "0076bd", 
"df002c", "0d6928", "f3ba22", "8b004c", "000000", "002d73", "89cbc1", 
"00A77E"), stripe = c("NULL", "NULL", "NULL", "NULL", "NULL", 
"NULL", "NULL", "NULL", "NULL", "NULL", "NULL", "NULL", "FFFFFF"
)), class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA, 
-13L), .Names = c("line", "name", "colour", "stripe"), spec = structure(list(
    cols = structure(list(line = structure(list(), class = c("collector_integer", 
    "collector")), name = structure(list(), class = c("collector_character", 
    "collector")), colour = structure(list(), class = c("collector_character", 
    "collector")), stripe = structure(list(), class = c("collector_character", 
    "collector"))), .Names = c("line", "name", "colour", "stripe"
    )), default = structure(list(), class = c("collector_guess", 
    "collector"))), .Names = c("cols", "default"), class = "col_spec"))

textAlong

Hi Thomas,

Am getting an error:
Error in makeContent.textalong(x) : could not find function "convertX"
Called from: makeContent.textalong(x)

Can you help?

Can't set fixed color for edges with color =

Setting a color outside the aes doesn't work with color = or colour =. Reproducible example:

library(dplyr)
library(igraph)
library(ggraph)

data_frame("a", "b") %>%
  graph_from_data_frame() %>%
  ggraph(layout = "fr") +
  geom_edge_link(color = "green")
#> Error: Unknown parameters: colour

This does work if I set it to edge_colour (not colour, or edge_color, which give similar errors). This makes some sense to me in that the fixed aesthetic names aren't expanded.

Note that the docs for the function say it's possible to set a fixed color with the color = argument:

other arguments passed on to layer. There are three types of arguments you can use here:
* Aesthetics: to set an aesthetic to a fixed value, like color = "red" or size = 3.

Hierarchical Edge Budnles

Hey.

Thanks for some really cool tools, hoping they can be of use for me.

Been trying to understand the data structure needed to make the Hierarchical Edge Bundles map, but the flare data are just way too large to navigate. I can understand the purpose of flare$edges and flare$vertices, but I don't understand the purpose of flare$import . Could you maybe provide some more information about the data structure necessary for this plot?

Also, how is the naming of the edges and vertices indexed? I've tried this on my data (what I think is the correct structure at least for this part), but I keep getting this error:
Some vertex names in edge list are not listed in vertex data frame.

image

Fix position

Looking forward to the development of this package!. This is more of a feature request than an issue. I was just wondering if it is or will be possible to fix the position of a network layout. i.e. if you were to re-execute this code:

ggraph(graph = gr, layout = 'fr') + geom_edge_link(aes(size = weight), color = 'grey', alpha = 0.5) + geom_node_point(aes(color = class), size = 10) + coord_fixed() + ggforce::theme_no_axes()

that the layout would always be the same? I don't think this is doable through igraph and perhaps that means also not possible here? My rationale is because it would be great to be able to update the same network temporally showing how edges change - this would only make sense visually if the nodes remain in the same place.

Installation issue on Windows 8.1

By request, I open a new issue for this error. I am unable to install ggraph.

> devtools::install_github('thomasp85/ggraph')
Downloading GitHub repo thomasp85/ggraph@master
from URL https://api.github.com/repos/thomasp85/ggraph/zipball/master
Installing ggraph
"C:/PROGRA~1/R/R-3.3.2/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL  \
  "C:/Users/Emil/AppData/Local/Temp/Rtmp6ZxnXj/devtools20784fd71113/thomasp85-ggraph-777a81d"  \
  --library="C:/Users/Emil/Documents/R/win-library/3.3" --install-tests 

* installing *source* package 'ggraph' ...
** libs

*** arch - i386
c:/Rtools/mingw_32/bin/g++  -I"C:/PROGRA~1/R/R-3.3.2/include" -DNDEBUG    -I"C:/Users/Emil/Documents/R/win-library/3.3/Rcpp/include" -I"d:/Compiler/gcc-4.9.3/local330/include"     -O2 -Wall  -mtune=core2 -c RcppExports.cpp -o RcppExports.o
c:/Rtools/mingw_32/bin/g++  -I"C:/PROGRA~1/R/R-3.3.2/include" -DNDEBUG    -I"C:/Users/Emil/Documents/R/win-library/3.3/Rcpp/include" -I"d:/Compiler/gcc-4.9.3/local330/include"     -O2 -Wall  -mtune=core2 -c circlePack.cpp -o circlePack.o
circlePack.cpp: In function 'std::vector<NodePack*> createHierarchy(std::vector<int>, std::vector<double>)':
circlePack.cpp:378:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i = 0; i < parent.size(); ++i) {
                   ^
circlePack.cpp:382:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i = 0; i < parent.size(); ++i) {
                   ^
circlePack.cpp: In function 'int findTopNode(std::vector<NodePack*>&)':
circlePack.cpp:392:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i = 0; i < nodes.size(); ++i) {
                   ^
circlePack.cpp: In function 'Rcpp::NumericMatrix pack(Rcpp::NumericVector)':
circlePack.cpp:444:73: warning: narrowing conversion of '(circles.std::deque<_Tp, _Alloc>::size<Circle, std::allocator<Circle> >() + 1u)' from 'std::deque<Circle>::size_type {aka unsigned int}' to 'int' inside { } is ill-formed in C++11 [-Wnarrowing]
         Circle c = {0, 0, std::sqrt(float(*itr / M_PI)), circles.size() + 1};
                                                                         ^
circlePack.cpp: In function 'Rcpp::NumericMatrix circlePackLayout(Rcpp::IntegerVector, Rcpp::NumericVector)':
circlePack.cpp:476:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i = 0; i < nodes.size(); ++i) {
                   ^
c:/Rtools/mingw_32/bin/g++  -I"C:/PROGRA~1/R/R-3.3.2/include" -DNDEBUG    -I"C:/Users/Emil/Documents/R/win-library/3.3/Rcpp/include" -I"d:/Compiler/gcc-4.9.3/local330/include"     -O2 -Wall  -mtune=core2 -c iciclePlot.cpp -o iciclePlot.o
In file included from iciclePlot.cpp:2:0:
nodes.h: In member function 'std::vector<Node*> Node::getChildren()':
nodes.h:45:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i = 0; i < children.size(); ++i) {
                           ^
iciclePlot.cpp: In function 'std::vector<Node*> createHierarchy(std::vector<int>, std::vector<int>, std::vector<double>, std::vector<double>)':
iciclePlot.cpp:8:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i = 0; i < parent.size(); ++i) {
                   ^
iciclePlot.cpp:12:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i = 0; i < parent.size(); ++i) {
                   ^
iciclePlot.cpp: In function 'void icicleLayout(Node*, double, double)':
iciclePlot.cpp:26:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i = 0; i < children.size(); i++) {
                           ^
iciclePlot.cpp: In function 'Rcpp::NumericMatrix partitionTree(Rcpp::IntegerVector, Rcpp::IntegerVector, Rcpp::NumericVector, Rcpp::NumericVector)':
iciclePlot.cpp:40:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i = 0; i < nodes.size(); ++i) {
                   ^
iciclePlot.cpp:47:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i = 0; i < nodes.size(); ++i) {
                   ^
c:/Rtools/mingw_32/bin/g++  -I"C:/PROGRA~1/R/R-3.3.2/include" -DNDEBUG    -I"C:/Users/Emil/Documents/R/win-library/3.3/Rcpp/include" -I"d:/Compiler/gcc-4.9.3/local330/include"     -O2 -Wall  -mtune=core2 -c lineCutter.cpp -o lineCutter.o
lineCutter.cpp: In function 'Point ellipsis_intersection(Point, Point, double, double)':
lineCutter.cpp:90:9: error: 'copysign' is not a member of 'std'
     x = std::copysign(x, pX);
         ^
lineCutter.cpp:90:9: note: suggested alternative:
In file included from C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/cmath:44:0,
                 from C:/Users/Emil/Documents/R/win-library/3.3/Rcpp/include/Rcpp/platform/compiler.h:100,
                 from C:/Users/Emil/Documents/R/win-library/3.3/Rcpp/include/Rcpp/r/headers.h:48,
                 from C:/Users/Emil/Documents/R/win-library/3.3/Rcpp/include/RcppCommon.h:29,
                 from C:/Users/Emil/Documents/R/win-library/3.3/Rcpp/include/Rcpp.h:27,
                 from lineCutter.cpp:1:
C:/Rtools/mingw_32/i686-w64-mingw32/include/math.h:913:31: note:   'copysign'
   __CRT_INLINE double __cdecl copysign (double x, double y)
                               ^
lineCutter.cpp:91:9: error: 'copysign' is not a member of 'std'
     y = std::copysign(y, pY);
         ^
lineCutter.cpp:91:9: note: suggested alternative:
In file included from C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/cmath:44:0,
                 from C:/Users/Emil/Documents/R/win-library/3.3/Rcpp/include/Rcpp/platform/compiler.h:100,
                 from C:/Users/Emil/Documents/R/win-library/3.3/Rcpp/include/Rcpp/r/headers.h:48,
                 from C:/Users/Emil/Documents/R/win-library/3.3/Rcpp/include/RcppCommon.h:29,
                 from C:/Users/Emil/Documents/R/win-library/3.3/Rcpp/include/Rcpp.h:27,
                 from lineCutter.cpp:1:
C:/Rtools/mingw_32/i686-w64-mingw32/include/math.h:913:31: note:   'copysign'
   __CRT_INLINE double __cdecl copysign (double x, double y)
                               ^
make: *** [lineCutter.o] Error 1
Warning: running command 'make -f "C:/PROGRA~1/R/R-3.3.2/etc/i386/Makeconf" -f "C:/PROGRA~1/R/R-3.3.2/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="ggraph.dll" OBJECTS="RcppExports.o circlePack.o iciclePlot.o lineCutter.o pathAttr.o treemap.o"' had status 2
ERROR: compilation failed for package 'ggraph'
* removing 'C:/Users/Emil/Documents/R/win-library/3.3/ggraph'
Error: Command failed (1)

Sessioninfo

> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

locale:
[1] LC_COLLATE=Danish_Denmark.1252  LC_CTYPE=Danish_Denmark.1252    LC_MONETARY=Danish_Denmark.1252 LC_NUMERIC=C                   
[5] LC_TIME=Danish_Denmark.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] httr_1.2.1      R6_2.2.0        tools_3.3.2     withr_1.0.2     curl_2.3        memoise_1.0.0   git2r_0.18.0    digest_0.6.12  
[9] devtools_1.12.0

Other

Other things I tried:

  1. Installing treemap manually. Did not change anything.
  2. Googling various parts of this error. No hits.
  3. Restarting R.

Error with GeomEdgePath

I'm not actually sure this is the right place to inquire about this error as it may be with ggproto instead. Nevertheless, when running the code -

word_cooccurences <- tokenize_df %>% pairwise_count(word,linenumber, sort=TRUE, upper = FALSE)
set.seed(1254)
word_cooccurences %>%
filter(n >= 100) %>%
graph_from_data_frame() %>%
ggraph(layout = "fr")+
geom_edge_link(aes(edge_alpha = n, edge_width = n)) +
geom_node_point(color = "darkslategray4", size = 3) +
geom_node_text(aes(label = name), vjust = 2.5) +
theme_void()

I get the error -
Error: GeomEdgePath was built with an incompatible version of ggproto.
Please reinstall the package that provides this extension.

Will these be synced so that this works again? Will this be fixed?
Thanks,
Aaron

Possible to control line style for edges?

In addition to having arrowheads at the end of a line segment, it would be great to be able to put the directionality along the length of the stroke, as in the attached examples. Is there a way that could be implemented in the network graphs?

linesegmentsarrows

problem with repel = TRUE for geom_node_text

Thanks so much for your work on this great package.

I am having trouble with using geom_node_text with the current development version of ggplot2; I think this must be a very new problem because I wasn't having this problem until just recently.

If I do something like this:

gr <- make_graph('bull')
V(gr)$class <- sample(letters[1:3], gorder(gr), replace = TRUE)

gr %>%
  ggraph(layout = "fr") + 
  geom_node_text(aes(label = class), repel = TRUE) +
  geom_edge_link() +
  theme_void()

then I get this error:

Error: GeomTextRepel was built with an incompatible version of ggproto.
Please reinstall the package that provides this extension.

There are no errors without repel = TRUE.

Arrowheads overlap with/vanish under nodes

The lines representing edges always meet - they never end at the outside of a node. This has the side-effect of arrow heads either overcrowding a node, or vanishing under a node, depending on the order of geoms in your code.

Is there a way that the edge lines could terminate at the outside perimeter of a node so that arrows point to nodes rather than getting swallowed up?

viridis color scales

import viridis and and use it for scale_edge_colour_viridis(), etc.,

Will do a PR in the next few days if you don't first.

geom_edge_link0 makes ggplot2 bork

In running the whig example, I get

Error: ggplot2 doesn't know how to deal with data of class function

I isolated it to geom_edge_link0 (and I get the same error for other geom_edge_link functions.

What is going on here? This is with ggplot2 v2.0

GeomEdgePath incompatibility with ggproto version

Hi,

I'm getting the error:

Error: GeomEdgePath was built with an incompatible version of ggproto.
Please reinstall the package that provides this extension.

I'm not entirely sure which package is responsible for a given compatibility issue, but any advice on how to make this work again would be great.
Thanks,
Aaron

igraph example fails: ggplot2 doesn't know how to deal with data of class function

I got this error, then trying the example in the readme I got the same:

friendGraph <- graph_from_data_frame(highschool)
V(friendGraph)$degree <- degree(friendGraph, mode = 'in')
graph1957 <- subgraph.edges(friendGraph, which(E(friendGraph)$year ==1957), F)
graph1958 <- subgraph.edges(friendGraph, which(E(friendGraph)$year ==1958), F)
V(friendGraph)$pop.increase <- degree(graph1958, mode = 'in') > 
  degree(graph1957, mode = 'in')

ggraph(friendGraph, 'igraph', algorithm = 'kk') + 
  geom_edge_fan(aes(alpha = ..index..)) + 
  geom_node_point(aes(size = degree, colour = pop.increase)) + 
  scale_edge_alpha('Friends with', guide = 'edge_direction') + 
  scale_colour_manual('Improved', values = c('firebrick', 'forestgreen')) + 
  scale_size('# Friends') + 
  facet_wrap(~year) + 
  ggforce::theme_no_axes()

Error: ggplot2 doesn't know how to deal with data of class function

I came across it when adding the geom_node_point geom for my own graph:

ggg <- ggraph::ggraph(graph, "igraph", algorithm = 'nicely')
ggg <- ggg + ggraph::geom_node_point()

ggg ## all is well

ggg + ggraph::geom_edge_fan()
Error: ggplot2 doesn't know how to deal with data of class function

Something seems wrong with arrow specification

This doesn't add arrows to the ends of lines:

require(igraph)
gr <- make_graph('bull')
E(gr)$class <- sample(letters[1:3], gsize(gr), replace = TRUE)
V(gr)$class <- sample(letters[1:3], gorder(gr), replace = TRUE)

ggraph(gr, 'igraph', algorithm = 'nicely') +
  geom_edge_link(arrow = grid::arrow(length = unit(0.5, "cm")))

Installation error

Note that ggraph prints this error after installation

library(ggraph)

Error in get(Info[i, 1], envir = env) : 
  lazy-load database '/Library/Frameworks/R.framework/Versions/3.3/Resources/library/ggplot2/R/ggplot2.rdb' is corrupt
In addition: Warning message:
In get(Info[i, 1], envir = env) : internal error -3 in R_decompress1
Error: package or namespace load failed for ‘ggraph’

Plot networks from lavaan?

It would be neat if this package could implement the functionality that semPlot has.

http://sachaepskamp.com/semPlot/examples#Lavaan

It can extract the edge list/connection matrix from lavaan or lm class objects and automatically plot them. The results are not very pretty and hard to deal with because it's based on base plot. So I'm looking for some ggplot2 based solution for plotting SEMs. Right now I manually draw SEMs using e.g. draw.io or Google Draw. This is quite time-consuming, especially when updating numbers on paths.

I managed to convert that into an igraph object and plot it.

library(pacman)
p_load(lavaan, magrittr, igraph)

#fit simple reg
fit = sem("Sepal.Length ~ Sepal.Width + Petal.Length", data = iris)
fit_params = fit %>% parameterestimates()
fit_betas = fit_params %>% dplyr::filter(op == "~") %>% `[`("est") %>% unlist

#adj mats
beta_mat = fit@Model@GLIST$beta
log_mat = (fit@Model@GLIST$beta != 0)
adj_mat = log_mat %>% as.integer %>% matrix(nrow = nrow(fit@Model@GLIST$beta), byrow = T)
rownames(adj_mat) = colnames(adj_mat) = fit@[email protected][[1]]
betas = beta_mat[log_mat]

#to igraph
adj_mat %>% 
  graph_from_adjacency_matrix() %>% 
  plot.igraph(edge.label = betas %>% round(2)
              )

#alternative approach
fit_params %>% 
  dplyr::filter(op == "~") %>% 
  `[`(c("rhs", "lhs")) %>% 
  as.matrix %>% 
  graph_from_edgelist %>% 
  plot.igraph(edge.label = fit_betas %>% round(2))

I was not able to get further because of #34.

Installation error: object ‘as_data_frame’ is not exported by 'namespace:igraph'

I get this error installing ggraph:

> devtools::install_github('thomasp85/ggraph')
Downloading github repo thomasp85/ggraph@master
Installing ggraph
'/usr/lib/R/bin/R' --vanilla CMD INSTALL  \
  '/tmp/Rtmp1rxdpd/devtools21c11ac110b/thomasp85-ggraph-10f24be'  \
  --library='/home/user/R/x86_64-pc-linux-gnu-library/3.2'  \
  --install-tests 

* installing *source* packageggraph...
** R
** preparing package for lazy loading
Error : objectas_data_frameis not exported by 'namespace:igraph'
ERROR: lazy loading failed for packageggraph* removing/home/mgagliol/R/x86_64-pc-linux-gnu-library/3.2/ggraphError: Command failed (1)

ggplot2@patch-2 and ggforce give no problem.
Using igraph 0.7.1 and R 3.2.3

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.