-
Notifications
You must be signed in to change notification settings - Fork 0
/
interactive-plot.R
32 lines (28 loc) · 1.2 KB
/
interactive-plot.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
library(plotly)
manga_top_100_inter <-
df_manga_top_100 %>%
pivot_wider(names_from = type,
values_from = rank)
top_100 <- plot_ly(manga_top_100_inter,
x = ~ manga,
y = ~ year,
name = "manga",
type = 'scatter',
mode = "markers",
text = ~title,
marker = list(color = "pink"),
hovertemplate = paste('rank: %{x}', '<br>%{text}<br>'),
texttemplate = '%{text}', textposition = 'outside')
top_100 <- top_100 %>% add_trace(x = ~ `light novel`,
y = ~ year,
name = "light novel",
type = 'scatter',
mode = "markers",
text = ~title,
marker = list(color = "blue"),
hovertemplate = paste('rank: %{x}', '<br>%{text}<br>'),
texttemplate = '%{text}', textposition = 'outside')
top_100 <- top_100 %>% layout(
title = "Top 100 Manga and Light Novel",
xaxis = list(title = "rank"),
margin = list(l = 100))