Skip to content

Commit

Permalink
Merge branch 'main' into v1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
rakow authored Oct 16, 2023
2 parents d0e251e + c981f68 commit f7ca93f
Showing 1 changed file with 76 additions and 2 deletions.
78 changes: 76 additions & 2 deletions src/main/R/Analysis/srv.R
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ p2_aggr <- ggplot(data=aggr, mapping = aes(x=1, y=share, fill=mode)) +
scale_fill_locuszoom() +
theme_void()

g <- arrangeGrob(p1_aggr, p2_aggr, ncol = 2)
g <- arrangeGrob(p1_aggr, p2_aggr, nrow = 2)
ggsave(filename = "modal-split.png", path = ".", g,
width = 12, height = 2, device='png', dpi=300)
width = 6, height = 2, device='png', dpi=300)


#########
Expand Down Expand Up @@ -186,4 +186,78 @@ shortDistance <- sum(filter(sim, dist_group=="0 - 1000")$trips)
numTrips = (shortDistance - calib_sum * tripShare) / (tripShare - 1)


########################

srv0 <- srv %>%
filter(dist_group=="0 - 1000") %>%
mutate(sum_group = sum(trips))

srv13 <- srv %>%
filter(dist_group=="1000 - 3000") %>%
mutate(sum_group = sum(trips))

srv35 <- srv %>%
filter(dist_group=="3000 - 5000") %>%
mutate(sum_group = sum(trips))

srv510 <- srv %>%
filter(dist_group=="5000 - 10000") %>%
mutate(sum_group = sum(trips))

srv1020 <- srv %>%
filter(dist_group=="10000 - 20000") %>%
mutate(sum_group = sum(trips))

srv20 <- srv %>%
filter(dist_group=="20000+") %>%
mutate(sum_group = sum(trips))

srv <- bind_rows(srv0,srv13,srv35,srv510,srv1020,srv20) %>%
mutate(share_group = trips / sum_group)

sim0 <- sim %>%
filter(dist_group=="0 - 1000") %>%
mutate(sum_group = sum(trips))

sim13 <- sim %>%
filter(dist_group=="1000 - 3000") %>%
mutate(sum_group = sum(trips))

sim35 <- sim %>%
filter(dist_group=="3000 - 5000") %>%
mutate(sum_group = sum(trips))

sim510 <- sim %>%
filter(dist_group=="5000 - 10000") %>%
mutate(sum_group = sum(trips))

sim1020 <- sim %>%
filter(dist_group=="10000 - 20000") %>%
mutate(sum_group = sum(trips))

sim20 <- sim %>%
filter(dist_group=="20000+") %>%
mutate(sum_group = sum(trips))

sim <- bind_rows(sim0,sim13,sim35,sim510,sim1020,sim20) %>%
mutate(share_group = trips / sum_group)

by_distance <- bind_rows(filter(srv, mode!="total_distance_distribution"), sim) %>%
mutate(mode=fct_relevel(mode, "walk", "bike", "pt", "ride", "car"))

dist_order <- factor(by_distance$dist_group, level = levels)
dist_order <- fct_explicit_na(dist_order, "100000+")

g <- ggplot(by_distance, aes(y=share_group, x=source, fill=mode)) +
labs(subtitle = paste("Kelheim scenario", substring(f, 52)), x="distance [m]", y="share") +
geom_bar(position="stack", stat="identity", width = 0.5) +
facet_wrap(dist_order, nrow = 1) +
scale_fill_locuszoom() +
theme_minimal()
g

ggsave(filename = "modal-distance-distribution-relative.png", path = ".", g,
width = 12, height = 10, device='png', dpi=300)



0 comments on commit f7ca93f

Please sign in to comment.