- library(dplyr)
- library(ggplot2)
- library(plotly)
04/06/2019
library(dplyr);library(ggplot2);library(plotly)
## ## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats': ## ## filter, lag
## The following objects are masked from 'package:base': ## ## intersect, setdiff, setequal, union
## ## 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
M = mtcars %>%
plot_ly(x=~wt, y=~mpg,mode="markers",type="scatter",
color=~cyl,size=~hp)
## Warning: `line.width` does not currently support multiple values.
library(dplyr);library(ggplot2);library(plotly) trace_0 <- rnorm(100, mean = 5) trace_1 <- rnorm(100, mean = 0) trace_2 <- rnorm(100, mean = -5) x <- c(1:100) data <- data.frame(x, trace_0, trace_1, trace_2) p <- plot_ly(data, x = ~x, y = ~trace_0, name = 'trace 0', type = 'scatter', mode = 'lines') %>% add_trace(y = ~trace_1, name = 'trace 1', mode = 'lines+markers') %>% add_trace(y = ~trace_2, name = 'trace 2', mode = 'markers')
p