forked from cs573-22s/a2-DataVis-5ways
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrCode(plotly).rmd
More file actions
23 lines (19 loc) · 815 Bytes
/
Copy pathrCode(plotly).rmd
File metadata and controls
23 lines (19 loc) · 815 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# https://plotly.com/r/getting-started/
# https://plotly.com/r/line-and-scatter/
# https://plotly.com/r/figure-labels/
# https://stackoverflow.com/questions/37809906/control-which-tick-marks-labels-appear-on-x-axis-in-plotly
library(plotly)
col <- c("orchid", "lightblue", "lightgreen", "darkgrey", "pink")
img <- plot_ly(carsdf,
x = carsdf$Weight,
y = carsdf$MPG,
color = carsdf$Manufacturer,
type = "scatter",
colors = col)
img <- img %>% layout(xaxis = list(title = 'Weight'),
yaxis = list(title = 'MPG'),
legend = list(title=list(text='<b> Manufacturer </b>')))
img <- img %>%
layout(xaxis = list(autotick = F, dtick = 1000),
yaxis = list(autotick = F, dtick = 10))
img