Skip to content

Commit

Permalink
CRAN release
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasp85 committed Feb 24, 2017
1 parent c0bb74e commit 0d099f3
Show file tree
Hide file tree
Showing 7 changed files with 226 additions and 824 deletions.
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
Package: ggraph
Type: Package
Title: An Implementation of Grammar of Graphics for Graphs and Networks
Version: 0.1.1
Date: 2016-02-02
Version: 1.0.0
Date: 2017-02-23
Author: Thomas Lin Pedersen
Maintainer: Thomas Lin Pedersen <[email protected]>
Description: The grammar of graphics as implemented in ggplot2 is a poor fit for
graph and network visualizations due to its reliance on tabular data input.
ggraph is an extension of the ggplot2 API tailored to graph visualizations
and provides the same flexible approach to building up plots layer by layer.
License: GPL-3 + file LICENSE
License: GPL-3
LazyData: TRUE
Imports:
Rcpp (>= 0.12.2),
Expand All @@ -30,7 +30,7 @@ Suggests: network,
knitr,
rmarkdown
LinkingTo: Rcpp
RoxygenNote: 6.0.0.9000
RoxygenNote: 6.0.1
Depends:
R (>= 2.10),
ggplot2 (>= 2.0.0)
Expand Down
644 changes: 0 additions & 644 deletions LICENSE

This file was deleted.

34 changes: 34 additions & 0 deletions LICENSE.note
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
The circle packing and minimal enclosing circle algorithms used in the functions
layout_igraph_circlepack() and pack_circles() have been implemented with great
help and inspiration from the source code of D3.js. The use of any of these
function are therefore furthermore under the D3.js license copied below:

D3.js license ------------------------------------------------------------------

Copyright 2010-2016 Mike Bostock
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of the author nor the names of contributors may be used to
endorse or promote products derived from this software without specific prior
written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Binary file added README-unnamed-chunk-2-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
106 changes: 106 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
---
output: github_document
---

<!-- README.md is generated from README.Rmd. Please edit that file -->

```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```

![ggraph logo](inst/ggraph.png)

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

[![Travis-CI Build Status](https://travis-ci.org/thomasp85/ggraph.svg?branch=master)](https://travis-ci.org/thomasp85/ggraph)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/thomasp85/ggraph?branch=master&svg=true)](https://ci.appveyor.com/project/thomasp85/ggraph)
[![CRAN_Release_Badge](http://www.r-pkg.org/badges/version-ago/ggraph)](https://CRAN.R-project.org/package=ggraph)
[![CRAN_Download_Badge](http://cranlogs.r-pkg.org/badges/ggraph)](https://CRAN.R-project.org/package=ggraph)

## A grammar of graphics for relational data
ggraph is an extension of [`ggplot2`](http://ggplot2.tidyverse.org) 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
```{r}
library(ggraph)
library(igraph)
# Create graph of highschool friendships
graph <- graph_from_data_frame(highschool)
V(graph)$Popularity <- degree(graph, mode = 'in')
# plot using ggraph
ggraph(graph, layout = 'kk') +
geom_edge_fan(aes(alpha = ..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**](http://www.data-imaginist.com/2017/ggraph-introduction-layouts/)
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 avaiable in `igraph` and
furthermore provides a large selection of its own, such as hive plots, treemaps,
and circle packing.
2. [**The Nodes**](http://www.data-imaginist.com/2017/ggraph-introduction-nodes/)
are the connected enteties 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**](http://www.data-imaginist.com/2017/ggraph-introduction-edges/)
are the connections between the enteties 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 plottet,
but often some sort of line is warranted.

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

### Supported data types
There are many different ways to store and work with relational data in R. Out
of the box `ggraph` comes with first-class support for `igraph` and `dendrogram`
objects, while `network` and `hclust` objects are supported through automatic
conversion to one of the above. Users can add support for other data structures
by writing a set of methods for that class. If this is of interest it is
discussed further in the [layouts](http://www.data-imaginist.com/2017/ggraph-introduction-layouts/).

## 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`

```{r, eval=FALSE}
devtools::install_github('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 ambituous.
[`ggdendro`](https://CRAN.R-project.org/package=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`](http://bioconductor.org/packages/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`](https://CRAN.R-project.org/package=ggnetwork),
[`geomnet`](https://CRAN.R-project.org/package=geomnet), and
[`GGally`](https://CRAN.R-project.org/package=GGally) all provide some
functionality though none of them are as extensive in scope as `ggraph`.

Loading

0 comments on commit 0d099f3

Please sign in to comment.