Plotly Cheatsheet
Plotly Cheatsheet
seed( 123 )
x = c( 1, 2, 3 ), x = c( 1, 2, 3 ), x = 1 : 100 x = 1 : 100
y = c( 5, 6, 7), y = c( 5, 6, 7 ), y1 = 2*x + rnorm ( 100 ) y1 = 2*x + rnorm( 100 )
type = scatter , type = scatter , y2 = -2*x + rnorm ( 100 ) y2 = -2*x + rnorm( 100 )
mode = lines ) mode = markers ,
size = c( 1, 5, 10 ), plot_ly ( axis_template <- list(
marker = list( x=x, showgrid = F ,
color = c( red, blue , y = y1 , zeroline = F ,
green ))) type = scatter ) %>% nticks = 20 ,
showline = T ,
add_trace( title = AXIS ,
x=x, mirror = all )
y = y2 ) %>%
plot.ly/r/getting-started plot_ly ( plot_ly (
x = c( 1, 2, 3 ), x=x,
layout(
y = c( 5, 6, 7 ), y = y1 ,
legend =
type = scatter , type = scatter ) %>%
list( x = 0.5 ,
mode = markers ) y=1,
bgcolor = #F3F3F3 )) layout(
xaxis = axis_template ,
yaxis = axis_template )
library( plotly )
p <- plot_ly (
x = rnorm( 1000 ),
y = rnorm( 1000 ),
mode = markers )
plot_ly ( plot_ly (
x = c( 1, 2, 3), x = c( 1, 2, 3 ),
y = c( 5, 6, 7), y = c( 5, 6, 7 ),
type = bar , type = scatter ,
mode = markers ) mode = lines ,
ll = tozeroy )
plot_ly ( plot_ly ( )
x <- rchisq ( 100, 5, 0 )
type = scattergeo , # Using a dataframe: data data.frame
plot_ly (
lon = c( -73.5, 151.2 ) , plot_ly ( add _trace list ( )
x=x,
lat = c( 45.5, -33.8 ) , type = surface , x, y, z, c ( )
type = histogram )
marker = list ( z = ~volcano ) color, text, size c ( )
color = c( red , blue ) , colorscale string or c ( )
size = c( 30, 50 ) , marker list ( )
mode = markers )) color string
symbol list ( )
line list ( )
color string
width 123
c ( ) = array
list ( ) = list
string = string
123 = number