Plotting graphs with Plotly for R
If you want to use it there is a lot of proper tutorials out there;
- R Tutorials: breaks down all the basics.
- Plotly’s Documentation: examples of all the graphing types.
- R Google Style Guide: quick and dirty style guide, if worried about some common standards.
Plotly - Example
.csv generated from a different application, plotly makes it very easy to write an R script to visualise the data. An example of one script is below.
install.packages("plotly") # make sure we install the plotly package first library(plotly) # setup the library data <- read.csv("../path-to-our-csv/data.csv") # load in our data p <- plot_ly( data, x = ~t, # match to the t column in data y = ~x, # match to the x column in data name = "wx", type = 'scatter', mode = 'lines' ) %>% add_trace(y = ~y, name = "wy", mode = 'lines') %>% add_trace(y = ~z, name = "wz", mode = 'lines') %>% layout(title = "Angular Speed Over Time", yaxis = list(title = "wx, wy, wz")) # make a pretty scatter plot p # run it
Generates the following plot from this this data.