Plotly R Cheat Sheet Page 2

ADVERTISEMENT

plot_ly
( )
plot_ly
(
x
<-
rchisq
( 100, 5,
0
)
# Using a dataframe:
data data.frame
type
=
‘scattergeo’
,
plot_ly
(
plot_ly
(
add _trace
list
( )
lon
= c( -73.5,
151.2
) ,
x
=
x ,
type
=
‘surface’
,
x, y, z,
c
( )
lat
= c( 45.5,
-33.8
) ,
type
=
‘histogram’
)
z
=
~volcano
)
color, text, size
c
( )
marker
=
list
(
colorscale
‘string’
or
c
( )
color
= c(
‘red’
,
‘blue’
) ,
marker
list
( )
size
= c( 30,
50
) ,
color
‘string’
mode
=
‘markers’
))
symbol
list
( )
line
list
( )
color
‘string’
width
123
plot_ly
(
layout
( )
plot_ly
(
plot_ly
(
type
=
‘scatter3d’
,
title
‘string’
y
= rnorm(
50
) ,
type
=
‘choropleth’
,
x
= c( 9, 8, 5,
1
) ,
xaxis,
yaxis
list
( )
type
=
‘box’
) %>%
locations
= c( ‘ A Z’, ‘CA’, ‘VT’ ) ,
y
= c( 1, 2, 4,
8
) ,
scenelist
( )
locationmode
=
‘USA-states’
,
z
= c( 11, 8, 15,
3
) ,
xaxis, yaxis, zaxis
list
( )
colorscale
=
‘Viridis’
,
add_trace(
y
= rnorm( 50,
1
))
mode
=
‘lines’
)
geo
list
( )
z
= c( 10, 20,
40
)) %>%
legend
list
( )
layout
(
geo
=
list
(
scope
=
‘usa’
))
annotations
list
( )
c
( ) =
array
list
( ) =
list
‘string’
= string
123
= number
plot_ly
(
plot_ly
(
plot_ly
(
type
=
‘scattergeo’
,
type
=
‘scatter3d’
,
x
= rnorm(
1000,
sd
=
10
) ,
lon
= c( 42,
39
) ,
x
= c( 9, 8, 5,
1
) ,
y
= rnorm(
1000,
sd
=
5
) ,
lat
= c( 12,
22
) ,
y
= c( 1, 2, 4,
8
) ,
type
=
‘histogram2d’
)
text
= c(
‘Rome’
,
‘Greece’
) ,
z
= c( 11, 8, 15,
3
) ,
mode
=
‘markers’
)
mode
=
‘markers’
)

ADVERTISEMENT

00 votes

Related Articles

Related forms

Related Categories

Parent category: Education
Go
Page of 2