Skip to content

Commit 1253307

Browse files
committed
Use plotly
1 parent f737af4 commit 1253307

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

code/scenarios/sao paulo/streamline_travel_survey.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Load libraries
22
library(tidyverse)
3+
library(plotly)
34

45
# Read sao paulo's travel survey
56
rd <- read_csv("data/scenarios/sao paulo/SP 2012 travel data.csv")
@@ -59,12 +60,13 @@ mode_df <- data.frame(
5960

6061
rd$mode_string <- as.character(mode_df$mode_string[match(rd$mode, mode_df$mode_int)])
6162

62-
ggplot(rd %>%
63+
plotly::ggplotly(ggplot(rd %>%
6364
filter(!is.na(mode)) %>%
6465
group_by(mode_string) %>%
6566
summarise(count = n()) %>%
6667
mutate(perc = round(count/sum(count) * 100, 1)),
6768
aes(x = mode_string, y = perc)) +
6869
geom_bar(stat="identity") +
70+
theme_minimal() +
6971
theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
70-
labs(x = "", y = "percentage(%)", title = "Main Mode distribution")
72+
labs(x = "", y = "percentage(%)", title = "Main Mode distribution"))

0 commit comments

Comments
 (0)