Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.travis.yml
.lintr
^.*\.Rproj$
^\.Rproj\.user$
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.Rproj.user
.Rhistory
.RData
.Ruserdata
.httr-oauth
DEV
17 changes: 9 additions & 8 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
Package: threejs
Type: Package
Title: Interactive 3D Scatter Plots, Networks and Globes
Description: Create interactive 3D scatter plots, network plots, and
globes using the 'three.js' visualization library ("http://threejs.org").
Title: Interactive 3D Scatter Plots, Networks, Globes and Cities
Description: Create interactive 3D scatter plots, network plots, globes and cities using the 'three.js' visualization library ("http://threejs.org").
Version: 0.3.0
Date: 2016-12-30
Authors@R: c(
Expand All @@ -11,13 +10,15 @@ Authors@R: c(
person("Alexey", "Stukalov", role=("ctb"), email="astukalov@gmail.com"),
person("Yihui","Xie", role=("ctb"), email="xie@yihui.name"),
person("Andreas", "Briese", role=("ctb"), email="ab@edutoolbox.de"),
person("B.", "Thieurmel", role=("ctb"), email="bthieurmel@gmail.com")
person("B.", "Thieurmel", role=("ctb"), email="bthieurmel@gmail.com"),
person("Vincent", "Terrasi", role=("ctb"), email="vt3ktek@hotmail.com")
)
URL: http://bwlewis.github.io/rthreejs
BugReports: https://github.com/bwlewis/rthreejs/issues
URL: https://github.com/voltek62/seo-viz
BugReports: https://github.com/voltek62/seo-viz/issues
License: MIT + file LICENSE
Depends:
R (>= 3.0.0), igraph (>= 1.0.0)
R (>= 3.0.0),
igraph (>= 1.0.0)
Imports:
htmlwidgets (>= 0.3.2),
base64enc,
Expand All @@ -26,4 +27,4 @@ Suggests:
htmltools (>= 0.2.6),
maps
Enhances: knitr, shiny
RoxygenNote: 5.0.0
RoxygenNote: 5.0.1
3 changes: 3 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
YEAR 2017 :
COPYRIGHT HOLDER: Vincent Terrasi

YEAR: 2015
COPYRIGHT HOLDER: Bryan W. Lewis

Expand Down
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Generated by roxygen2: do not edit by hand

export(cityOutput)
export(cityjs)
export(globeOutput)
export(globejs)
export(graphjs)
export(renderCity)
export(renderGlobe)
export(renderScatterplotThree)
export(scatterplot3js)
Expand Down
43 changes: 43 additions & 0 deletions R/city.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

#' @export
cityjs <- function(
value=40,
color="#00ffff",
atmosphere=FALSE,
bg="black",
height = NULL,
width = NULL, ...)
{

options <- list(color=color, value=value, atmosphere=atmosphere, bg=bg)
additional_args <- list(...)
if(length(additional_args) > 0) options <- c(options, additional_args)

x <- c(options)

htmlwidgets::createWidget(
name = "city",
x = x,
width = width,
height = height,
htmlwidgets::sizingPolicy(padding = 0, browser.fill = TRUE),
package = "threejs")
}

#' @rdname threejs-shiny
#' @export
cityOutput <- function(outputId, width = "100%", height = "600px") {

shinyWidgetOutput(outputId, "city", width, height,
package = "threejs")
}

#' @rdname threejs-shiny
#' @export
renderCity <- function(expr, env = parent.frame(), quoted = FALSE) {

if (!quoted) {
expr <- substitute(expr)
} # force quoted
shinyRenderWidget(expr, cityOutput, env, quoted = TRUE)
}
75 changes: 12 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Three.js widgets for R and shiny. The package includes
* graphjs: an interactive force directed graph widget
* scatterplot3js: a 3-d scatterplot widget similar to the scatterplot3d function
* globejs: a widget that plots data and images on a 3-d globe
* cityjs : a widget that generate a 3-d city with your SEO data

The widgets are easy to use and render directly in RStudio, in R markdown, in
Shiny applications, and from command-line R via a web browser. They produce
Expand All @@ -17,87 +18,35 @@ pointclouds with hundreds of thousands of points.

See http://threejs.org for details on three.js.

See http://bwlewis.github.io/rthreejs for an example.

This project is based on the htmlwidgets package. See
https://github.com/ramnathv/htmlwidgets for details and links to amazingly cool
visualization widgets for R.

# New in version 0.3.0 (January, 2017)

The new 0.3.0 package version includes major changes. The `scatterplot3js` function
generally works as before but with many more capabilities, but the `graphjs` function
is very different with a new API (sorry for the big breaking change!).

`graphjs` is now much more tightly bound to the superb igraph package, and the
threejs package now depends on that. Why igraph?

1. If you're doing serious network analysis, you're probably already using igraph (or you should be).
2. We now use external graph layouts (either from igraph or elsewhere). This gives much greater
graph layout flexibility, something I was looking for. But also removes the cute (but slow and
crude) force-directed JavaScript animation previously used. To partially make up for that, a
very basic but flexible graph animation scheme is now in place that's easy to use. See `?graphjs`
for examples.

The good news is that performance is generally much improved, using custom
WebGL shaders where needed.

## What else is new in version 0.3.0

The `scatterplot3js` function was substantially improved and updated.

- The new `pch` option supports many point styles with size control.
- Interactive rotation and zooming are greatly improved and panning is now supported: press and hold the right mouse button (or touch equivalent) and move the mouse to pan.
- Mouse over labels are supported in WebGL renderings.
- Lines are supported too.

The `graphjs` function is completely new and now relies on `scatterplot3js`
under the hood.

- Greater variety of WebGL vertex rendering ("pch") options, including spheres
and much higher-performance options for large graphs.
- Graph layout is now external; for instance use one of the many superb
igraph package graph layout options.
- Basic graph animation is supported.

## Install

Use the devtools package to install threejs directly from GitHub on any
R platform (Mac, Windows, Linux, ...). You'll need the 'devtools' package.

Test 3D City
```r
if(!require("devtools")) install.packages("devtools")
devtools::install_github("bwlewis/rthreejs")
devtools::install_github("voltek62/seo-viz")
```


## Examples

See `?scatterplot3d` for more examples and detailed help.
```r
z <- seq(-10, 10, 0.1)
x <- cos(z)
y <- sin(z)
scatterplot3js(x, y, z, color=rainbow(length(z)))
runApp(system.file("examples/city", package="threejs"))
```

The next example illustrates the globe widget by plotting the relative
population of some cities using data from the R maps package on a globe. It's
based on the JavaScript WebGL Globe Toolkit (https://github.com/dataarts) by
the Google Creative Lab Data Arts Team.
```r
runApp(system.file("examples/globe", package="threejs"))
```
## Test

Example : /data/internal_html_simple.xlsx

First line : Internal - HTML
Second line : Address;Status Code;Level;Inlinks;GA Sessions

For detailed help on the widgets and additional examples, see
```r
?scatterplot3js
?globejs
```


# Status
<a href="https://travis-ci.org/bwlewis/rthreejs">
<img src="https://travis-ci.org/bwlewis/rthreejs.svg?branch=master" alt="Travis CI status"></img>
</a>
[![codecov.io](https://codecov.io/github/bwlewis/rthreejs/coverage.svg?branch=master)](https://codecov.io/github/bwlewis/rthreejs?branch=master)
[![CRAN version](http://www.r-pkg.org/badges/version/threejs)](https://cran.r-project.org/packages=threejs)
![](http://cranlogs.r-pkg.org/badges/threejs)
Binary file added data/internal_html_simple.xlsx
Binary file not shown.
Loading