NEON EDUCATION bio photo

NEON EDUCATION

Devoted to open data and open source in science and education.

View All Tutorials

This tutorial is a part of a series!

Click below to view all lessons in the series!

Tags

LiDAR (9)
R programming (70)
Remote Sensing (12)
Data Visualization (4)
Hyperspectral Remote Sensing (7)
Hierarchical Data Formats (HDF5) (24)
Spatial Data & GIS (18)
Time Series (15)
Phenology (7)
Raster Data (8)
Vector Data (6)
Metadata (1)
Git & GitHub (6)
(1) (1) (1)

Tutorial by R Package

dplyr (8)
ggplot2 (17)
h5py (1)
lubridate (time series) (6)
maps (1)
maptools (3)
plyr (2)
raster (32)
rasterVis (raster time series) (3)
rgdal (GIS) (23)
rgeos (5)
rhdf5 (21)
sp (7)
scales (4)
gridExtra (4)
ggtheme (0)
grid (2)
reshape2 (3)
plotly (6)

View ALL Tutorial Series




Twitter Youtube Github


Blog.Roll

R Bloggers

After completing the previous tutorial, you have an R object p that contains a ggplot plot. We’ll now make an interactive plot.ly plot.

If you have not completed the previous tutorial, the code for p can be found in the downloadable R code for this lesson, or complete the previous tutorial.

Now we can create an interactive plot.ly plot from the p R object.

Create Plot.ly Interactive Plot

Plot.ly is a free to use, online interactive data viz site. If you have the plot.ly library installed, you can quickly export a ggplot graphic into plot.ly! (NOTE: it also works for python matplotlib)!! To use plotly, you need to setup an account. Once you’ve setup an account, you can get your key from the plot.ly site to make the code below work.

Plotly R Documentation

# install.packages("plotly")
library(plotly)

# your ggplot - object
p

Create a local version of a plotly plot!

# plot your plot using plot_ly locally
ggplotly(p)

Push a plot plot to your plotly account! Feel free to use NEON’s credentials for this week!

# setup your plot.ly credentials
Sys.setenv("plotly_username"="yourUserName")
Sys.setenv("plotly_api_key"="yourAPIkey")

# generate the plot
plotly_POST(p,
            filename='NEON SJER CHM vs Insitu Tree Height') # let anyone in the world see the plot!

Check out the results!

NEON Remote Sensing Data compared to NEON Terrestrial Measurements for the SJER field site.

<b> LiDAR CHM Derived vs Measured Tree Height </b>

Get Lesson Code

(some browsers may require you to right click.)