library(plotly)
## Warning: package 'plotly' was built under R version 3.4.4
## Loading required package: ggplot2
## Warning: package 'ggplot2' was built under R version 3.4.4
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
library(bindrcpp)
## Warning: package 'bindrcpp' was built under R version 3.4.4
set.seed(100)
d <- diamonds[sample(nrow(diamonds),1000),]
plot_ly(d,x = ~carat, y = ~price, mode = "markers")
## No trace type specified:
## Based on info supplied, a 'scatter' trace seems appropriate.
## Read more about this trace type -> https://plot.ly/r/reference/#scatter
library(plotly)
plot_ly(mtcars, x = ~wt, y = ~mpg, mode = "markers")
## No trace type specified:
## Based on info supplied, a 'scatter' trace seems appropriate.
## Read more about this trace type -> https://plot.ly/r/reference/#scatter
Scatterplot with color (continous color)
plot_ly(mtcars, x = ~wt, y = ~mpg, mode = "markers", color = ~disp)
## No trace type specified:
## Based on info supplied, a 'scatter' trace seems appropriate.
## Read more about this trace type -> https://plot.ly/r/reference/#scatter
Scatterplot sizing
plot_ly(mtcars, x = ~wt, y = ~mpg, mode = "markers", color = ~qsec, size = ~hp)
## No trace type specified:
## Based on info supplied, a 'scatter' trace seems appropriate.
## Read more about this trace type -> https://plot.ly/r/reference/#scatter
3D Scatter plot(web gil)
set.seed(2016-07-21)
temp <- rnorm(100,mean = 30, sd = 5)
pressure <- rnorm(100)
dtime <- 1:100
plot_ly(x = ~temp, y = ~pressure, z = ~dtime, type = "scatter3d", mode = "markers", color = ~temp)