Skip to content

Commit

Permalink
0.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
hrbrmstr committed Dec 24, 2015
1 parent f16e5bb commit 1828103
Show file tree
Hide file tree
Showing 40 changed files with 505 additions and 9,688 deletions.
4 changes: 4 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ README\.Rmd
streamgraph\.Rmd
streamgraph\.html
^\.example.png$
^CONDUCT\.md$
^README\.html$
example\.png$
streamgraph\.md$
25 changes: 25 additions & 0 deletions CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Contributor Code of Conduct

As contributors and maintainers of this project, we pledge to respect all people who
contribute through reporting issues, posting feature requests, updating documentation,
submitting pull requests or patches, and other activities.

We are committed to making participation in this project a harassment-free experience for
everyone, regardless of level of experience, gender, gender identity and expression,
sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.

Examples of unacceptable behavior by participants include the use of sexual language or
imagery, derogatory comments or personal attacks, trolling, public or private harassment,
insults, or other unprofessional conduct.

Project maintainers have the right and responsibility to remove, edit, or reject comments,
commits, code, wiki edits, issues, and other contributions that are not aligned to this
Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed
from the project team.

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by
opening an issue or contacting one or more of the project maintainers.

This Code of Conduct is adapted from the Contributor Covenant
(http:contributor-covenant.org), version 1.0.0, available at
http://contributor-covenant.org/version/1/0/0/
18 changes: 11 additions & 7 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,24 @@ Package: streamgraph
Type: Package
Title: streamgraph is an htmlwidget for building streamgraph visualizations
Version: 0.8.1
Date: 2015-08-07
Date: 2015-12-24
Author: Bob Rudis (@hrbrmstr)
Maintainer: Bob Rudis <[email protected]>
Description: A streamgraph (or "stream graph") is a type of stacked area graph
which is displaced around a central axis, resulting in a flowing,
organic shape. Streamgraphs were developed by Lee Byron and popularized
by their use in a February 2008 New York Times article on movie
box office revenues. [Wikipedia] The streamgraph package is based on
the htmlwidget package and uses D3.js to render the visualizations.
which is displaced around a central axis, resulting in a flowing,
organic shape. Streamgraphs were developed by Lee Byron and popularized
by their use in a February 2008 New York Times article on movie
box office revenues. [Wikipedia] The streamgraph package is based on
the htmlwidget package and uses D3.js to render the visualizations.
URL: http://github.com/hrbrmstr/streamgraph
BugReports: https://github.com/hrbrmstr/streamgraph/issues
License: MIT + file LICENSE
Suggests:
testthat,
knitr
knitr,
babynames,
ggplot2movies
Encoding: UTF-8
Depends:
R (>= 3.0.0),
Imports:
Expand All @@ -27,3 +30,4 @@ Imports:
tidyr,
dplyr
VignetteBuilder: knitr
RoxygenNote: 5.0.1
6 changes: 2 additions & 4 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# Generated by roxygen2 (4.1.1): do not edit by hand
# Generated by roxygen2: do not edit by hand

export("%>%")
export(phantomInstall)
export(renderStreamgraph)
export(sg_add_marker)
export(sg_annotate)
export(sg_axis_x)
export(sg_axis_y)
Expand All @@ -19,8 +17,8 @@ export(widgetThumbnail)
import(htmltools)
import(htmlwidgets)
import(xts)
importFrom(dplyr,bind_rows)
importFrom(dplyr,arrange)
importFrom(dplyr,bind_rows)
importFrom(dplyr,left_join)
importFrom(dplyr,mutate)
importFrom(dplyr,select)
Expand Down
2 changes: 2 additions & 0 deletions R/annotate.r
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
. <- NULL

#' Add text annotation to streamgraph
#'
#' Use this function to place text at any point on a streamgraph. This
#' is especially useful for non-interactive streamgraphs (i.e. to label
#' a particular stream).
#'
#' @param sg streamgraph object
#' @param label text for the annotation
#' @param x horizontal position
#' @param y vertical position
Expand Down
10 changes: 5 additions & 5 deletions R/color.r
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' @examples \dontrun{
#' library(dplyr)
#' library(streamgraph)
#' ggplot2::movies %>%
#' ggplot2movies::movies %>%
#' select(year, Action, Animation, Comedy, Drama, Documentary, Romance, Short) %>%
#' tidyr::gather(genre, value, -year) %>%
#' group_by(year, genre) %>%
Expand Down Expand Up @@ -49,7 +49,7 @@ sg_colors <- function(sg, palette=NULL, axis_color="black", tooltip_color="black
#' @examples \dontrun{
#' library(dplyr)
#' library(streamgraph)
#' ggplot2::movies %>%
#' ggplot2movies::movies %>%
#' select(year, Action, Animation, Comedy, Drama, Documentary, Romance, Short) %>%
#' tidyr::gather(genre, value, -year) %>%
#' group_by(year, genre) %>%
Expand Down Expand Up @@ -82,7 +82,7 @@ sg_fill_brewer <- function(sg, palette="Spectral") {
#' @examples \dontrun{
#' library(dplyr)
#' library(streamgraph)
#' ggplot2::movies %>%
#' ggplot2movies::movies %>%
#' select(year, Action, Animation, Comedy, Drama, Documentary, Romance, Short) %>%
#' tidyr::gather(genre, value, -year) %>%
#' group_by(year, genre) %>%
Expand Down Expand Up @@ -125,7 +125,7 @@ sg_fill_tableau<- function(sg, palette="tableau20") {
#' @examples \dontrun{
#' library(dplyr)
#' library(streamgraph)
#' ggplot2::movies %>%
#' ggplot2movies::movies %>%
#' select(year, Action, Animation, Comedy, Drama, Documentary, Romance, Short) %>%
#' tidyr::gather(genre, value, -year) %>%
#' group_by(year, genre) %>%
Expand All @@ -134,7 +134,7 @@ sg_fill_tableau<- function(sg, palette="tableau20") {
#' mutate(year=as.Date(sprintf("%d-01-01", year))) -> dat
#'
#' streamgraph(dat, "genre", "n", "year") %>%
#' sg_fill_manual(c("black", "#ffa500", "blue", "white", "#00ff00', "red"))
#' sg_fill_manual(c("black", "#ffa500", "blue", "white", "#00ff00", "red"))
#' }
sg_fill_manual <- function(sg, values=NULL) {

Expand Down
3 changes: 2 additions & 1 deletion R/legend.r
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#'
#' TODO: legends for non-interactive streamgraphs
#'
#' @param sg streamgraph object
#' @param show if this is \code{TRUE} and \code{interactive} is \code{TRUE} then a popup menu
#' will be available that lists ll the keys in the data set. Selecting a key will
#' perform the same action as hovering over the area with the mouse.
Expand All @@ -15,7 +16,7 @@
#' @examples \dontrun{
#' library(dplyr)
#' library(streamgraph)
#' ggplot2::movies %>%
#' ggplot2movies::movies %>%
#' select(year, Action, Animation, Comedy, Drama, Documentary, Romance, Short) %>%
#' tidyr::gather(genre, value, -year) %>%
#' group_by(year, genre) %>%
Expand Down
1 change: 1 addition & 0 deletions R/marker.r
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#'
#' This is useful for marking/labeling notable events along the streams.
#'
#' @param sg streamgraph object
#' @param x horizontal position
#' @param label text for the annotation
#' @param stroke_width line width
Expand Down
6 changes: 1 addition & 5 deletions R/phantom.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ widgetThumbnail <- function(p, thumbPath) {
thumbPath <- path.expand(thumbPath)

if(phantom == "") {
message("** phantomjs dependency could not be found - thumbnail cannot be generated (run phantomInstall() for details)")
message("** phantomjs dependency could not be found - thumbnail cannot be generated\n (Please visit this page to install phantomjs on your system: http://phantomjs.org/download.html)")
} else {
res <- try({
ff <- tempfile(fileext = ".html")
Expand Down Expand Up @@ -36,10 +36,6 @@ page.open('file://", ff, "', function() {
}
}

#' @export
phantomInstall <- function() {
message("Please visit this page to install phantomjs on your system: http://phantomjs.org/download.html")
}

# similar to webshot
findPhantom <- function() {
Expand Down
6 changes: 2 additions & 4 deletions R/sg_axis_x.r
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
#' streamgraph x axis.
#'
#' @param sg streamgraph object
#' @param ticks when \code{scale} is \code{date}, \code{ticks} is the interval
#' between ticks. when \code{scale} is \code{continuous}, \code{ticks} is
#' the total number of ticks (i.e. "tick count") [defaults to \code{10}]
#' @param tick_interval tick interval
#' @param tick_units units for the ticks
#' @param tick_format how to show the labels (subset of \code{strftime}
#' formatters for \code{date} scale, otherwise \code{sprintf} formats for
#' \code{continuous} scale) (defaults to \code{\%b} - must specify if \code{continuous}).
Expand All @@ -17,7 +15,7 @@
#' @examples \dontrun{
#' library(dplyr)
#' library(streamgraph)
#' ggplot2::movies %>%
#' ggplot2movies::movies %>%
#' select(year, Action, Animation, Comedy, Drama, Documentary, Romance, Short) %>%
#' tidyr::gather(genre, value, -year) %>%
#' group_by(year, genre) %>%
Expand Down
2 changes: 1 addition & 1 deletion R/sg_axis_y.r
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#' @examples \dontrun{
#' library(dplyr)
#' library(streamgraph)
#' ggplot2::movies %>%
#' ggplot2movies::movies %>%
#' select(year, Action, Animation, Comedy, Drama, Documentary, Romance, Short) %>%
#' tidyr::gather(genre, value, -year) %>%
#' group_by(year, genre) %>%
Expand Down
7 changes: 6 additions & 1 deletion R/shiny.r
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

#' Widget output function for use in Shiny
#'
#' @param outputId outputId
#' @param width width
#' @param height height
#' @export
streamgraphOutput <- function(outputId, width = '100%', height = '400px'){
shinyWidgetOutput(outputId, 'streamgraph', width, height, package = 'streamgraph')
Expand All @@ -9,6 +11,9 @@ streamgraphOutput <- function(outputId, width = '100%', height = '400px'){

#' Widget render function for use in Shiny
#'
#' @param expr expr
#' @param env env
#' @param quoted quoted
#' @export
renderStreamgraph <- function(expr, env = parent.frame(), quoted = FALSE) {
if (!quoted) { expr <- substitute(expr) } # force quoted
Expand Down
3 changes: 2 additions & 1 deletion R/streamgraph.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#' @examples \dontrun{
#' library(dplyr)
#' library(streamgraph)
#' ggplot2::movies %>%
#' ggplot2movies::movies %>%
#' select(year, Action, Animation, Comedy, Drama, Documentary, Romance, Short) %>%
#' tidyr::gather(genre, value, -year) %>%
#' group_by(year, genre) %>%
Expand Down Expand Up @@ -177,6 +177,7 @@ streamgraph <- function(data,

#' Add a title to the streamgraph
#'
#' @param sg streamgraph object
#' @param title title
#' @return THIS DOES NOT RETURN AN \code{htmlwidget}!! It returns a \code{shiny.tag}
#' class HTML (the widget is wrapped in a \code{<div>}). It should be the LAST
Expand Down
23 changes: 8 additions & 15 deletions README.Rmd
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
title: "README"
author: "Bob Rudis"
date: August 7, 2015
title: "streamgraph"
output:
html_document:
keep_md: true
md_document:
variant: markdown_github
---

streamgraph is an htmlwidget for making streamgraphs.
streamgraph is an htmlwidget for making, well, _streamgraphs_.

![example](example.png)

Expand Down Expand Up @@ -41,6 +41,7 @@ The following functions are implemented:

### News

- Version `0.8.1` released - ggplot2 movies fix; corrected numerous notes from CRAN check
- Version `0.8` released - support for negative Y axis numbers and upgrade to latest D3
- Version `0.7.5` released - `key`, `value` and `date` can be either bare or quoted
- Version `0.7` released - New `sg_add_marker` and `sg_annotation` to enable annotation of streamgraphs
Expand Down Expand Up @@ -77,7 +78,7 @@ packageVersion("streamgraph")
library(dplyr)
ggplot2::movies %>%
ggplot2movies::movies %>%
select(year, Action, Animation, Comedy, Drama, Documentary, Romance, Short) %>%
tidyr::gather(genre, value, -year) %>%
group_by(year, genre) %>%
Expand All @@ -89,14 +90,6 @@ streamgraph(dat, "genre", "n", "year", interactive=TRUE) %>%
```

### Test Results

```{r}
library(streamgraph)
library(testthat)
date()
test_dir("tests/")
```
---------------

Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md). By participating in this project you agree to abide by its terms.
163 changes: 163 additions & 0 deletions README.html

Large diffs are not rendered by default.

Loading

0 comments on commit 1828103

Please sign in to comment.