parent
ee6ad9704a
commit
55fcc0518a
89
Heatmaps.R
89
Heatmaps.R
|
@ -11,7 +11,7 @@ setwd("~/BAK_Projekt")
|
|||
|
||||
#get datasets
|
||||
df_bak <- read.csv("~/BAK_Projekt/Liste_BAK4.csv", sep = ";")
|
||||
df_bin <- read.csv("~/BAK_Projekt/df_Akteure_binwide.csv", sep = ";")
|
||||
df_bin <- read.csv("~/BAK_Projekt/df_Akteure_binwide.csv", sep = ";")
|
||||
|
||||
#base map
|
||||
mapCH <- RSwissMaps::mapCH2016 %>% dplyr::rename("bfs_nr"="can")
|
||||
|
@ -78,25 +78,90 @@ ggsave(plot=f1_i, filename = "Figure1_i.jpg", device="jpg", width = 15, height =
|
|||
|
||||
|
||||
|
||||
##FIGURE 2
|
||||
##Materielles mobiles Kulturerbe
|
||||
df_mm2 <- dplyr::filter(df_binKanton, !(materielles...mobiles.Kulturerbe %in% "")) %>%
|
||||
group_by(Handlungsfelder, Hauptfinanzierungsträger, bfs_nr, Kanton) %>% dplyr::summarise(materielles_mobiles_Kulturerbe=n()) %>%
|
||||
filter(Handlungsfelder == "Reaktualisieren") %>% group_by(bfs_nr) %>% mutate(percent = prop.table(materielles_mobiles_Kulturerbe)) %>%
|
||||
filter(Hauptfinanzierungsträger != "privat")
|
||||
#add additional row as Uri appears to have no data instead of 0 percentage
|
||||
new.r_mm <- data.frame("Reaktualisieren", "staatlich/öffentlich", 4, "Uri", 0, 0)
|
||||
names(new.r_mm)<- colnames(df_mm2)
|
||||
df_mm2.1 <- rbind(df_mm2, new.r_mm)
|
||||
|
||||
f2_mm <- RSwissMaps::can.plot(df_mm2.1$bfs_nr, df_mm2.1$percent, 2016,
|
||||
boundaries = "c", boundaries_size = 0.2, boundaries_color = "white",
|
||||
title = "Anzahl Akteure (nach Hauptfinanzierungsträger) im Handlungsfeld\n'Reaktualisieren/Valorisieren' bezüglich materiellem und mobilem Kulturerbe",
|
||||
legend_title = "Je dunkler die Färbung, desto höher ist der\nprozentuale Anteil an staatliche/öffentliche Hauptfinanzierungsträgern")
|
||||
|
||||
##Materielles immobiles Kutlurerbe
|
||||
df_mi2 <- dplyr::filter(df_binKanton, !(materielles...immobiles.Kulturerbe %in% "")) %>%
|
||||
group_by(Handlungsfelder, Hauptfinanzierungsträger, bfs_nr, Kanton) %>% dplyr::summarise(materielles_immobiles_Kulturerbe=n()) %>%
|
||||
filter(Handlungsfelder == "Reaktualisieren") %>% group_by(bfs_nr) %>% mutate(percent = prop.table(materielles_immobiles_Kulturerbe)) %>%
|
||||
filter(Hauptfinanzierungsträger != "privat")
|
||||
|
||||
#add additional row as AG, GL, GR and ZH appears to have no data instead of 0 percentage
|
||||
new.r_mi <- data.frame(Handlungsfelder = c("Reaktualisieren"),
|
||||
Hauptfinanzierungsträger = "staatlich/öffentlich",
|
||||
bfs_nr = c(19, 8, 18, 1),
|
||||
Kanton = c("Aargau", "Glarus", "Graubünden", "Zürich"),
|
||||
materielles_immobiles_Kulturerbe = 0,
|
||||
percent = 0)
|
||||
df_mi2.1 <- rbind(df_mi2, new.r_mi)
|
||||
|
||||
f2_mi <- RSwissMaps::can.plot(df_mi2.1$bfs_nr, df_mi2.1$percent, 2016,
|
||||
boundaries = "c", boundaries_size = 0.2, boundaries_color = "white",
|
||||
title = "Anzahl Akteure (nach Hauptfinanzierungsträger) im Handlungsfeld\n'Reaktualisieren/Valorisieren' bezüglich materiellem und immobilem Kulturerbe",
|
||||
legend_title = "Je dunkler die Färbung, desto höher ist der\nprozentuale Anteil an staatliche/öffentliche Hauptfinanzierungsträgern")
|
||||
|
||||
##Immaterielles Kulturerbe
|
||||
df_i2 <- dplyr::filter(df_binKanton, !(immaterielles.Kulturerbe %in% "")) %>%
|
||||
group_by(Handlungsfelder, Hauptfinanzierungsträger, bfs_nr, Kanton) %>% dplyr::summarise(immaterielles.Kulturerbe=n()) %>%
|
||||
filter(Handlungsfelder == "Reaktualisieren") %>% group_by(bfs_nr) %>% mutate(percent = prop.table(immaterielles.Kulturerbe)) %>%
|
||||
filter(Hauptfinanzierungsträger != "privat")
|
||||
|
||||
#add additional row as AI, BE, SG and VS appears to have no data instead of 0 percentage
|
||||
new.r_i <- data.frame(Handlungsfelder = c("Reaktualisieren"),
|
||||
Hauptfinanzierungsträger = "staatlich/öffentlich",
|
||||
bfs_nr = c(16, 2, 17, 23),
|
||||
Kanton = c("Appenzell Ausserrhoden", "Bern", "St. Gallen", "Wallis"),
|
||||
materielles_immobiles_Kulturerbe = 0,
|
||||
percent = 0)
|
||||
df_i2.1 <- rbind(df_i2, new.r_i)
|
||||
|
||||
f2_i <- RSwissMaps::can.plot(df_i2.1$bfs_nr, df_i2.1$percent, 2016,
|
||||
boundaries = "c", boundaries_size = 0.2, boundaries_color = "white",
|
||||
title = "Anzahl Akteure (nach Hauptfinanzierungsträger) im Handlungsfeld\n'Reaktualisieren/Valorisieren' bezüglich immateriellem Kulturerbe",
|
||||
legend_title = "Je dunkler die Färbung, desto höher ist der\nprozentuale Anteil an staatliche/öffentliche Hauptfinanzierungsträgern")
|
||||
|
||||
|
||||
|
||||
|
||||
ggsave(plot=f2_mm, filename = "Figure2_mm.jpg", device="jpg", width = 15, height = 10,
|
||||
path = "~/BAK_Projekt/Figures")
|
||||
ggsave(plot=f2_mi, filename = "Figure2_mi.jpg", device="jpg", width = 15, height = 10,
|
||||
path = "~/BAK_Projekt/Figures")
|
||||
ggsave(plot=f2_i, filename = "Figure2_i.jpg", device="jpg", width = 15, height = 10,
|
||||
path = "~/BAK_Projekt/Figures")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
####Example for district map -> can be deleted####
|
||||
|
||||
####Example for district map####
|
||||
# Generating sample data:
|
||||
dt.dis <- dis.template(2016)
|
||||
for(i in 1:nrow(dt.dis)){dt.dis$values[i] <- sample(c(300:700), 1)/1000}
|
||||
# Plotting sample data:
|
||||
dis.plot(dt.dis$bfs_nr, dt.dis$values, 2016,
|
||||
boundaries = "c",
|
||||
title = "Beispiel auf Bezirksebene (random data)")
|
||||
#dt.dis <- dis.template(2016)
|
||||
#for(i in 1:nrow(dt.dis)){dt.dis$values[i] <- sample(c(300:700), 1)/1000}
|
||||
## Plotting sample data:
|
||||
#dis.plot(dt.dis$bfs_nr, dt.dis$values, 2016,
|
||||
# boundaries = "c",
|
||||
# title = "Beispiel auf Bezirksebene (random data)")
|
||||
# Plotting sample data for the canton of Aargau:
|
||||
dis.plot(dt.dis$bfs_nr, dt.dis$values, 2016, cantons = c("GR"),
|
||||
lakes = c("none"),
|
||||
title = "Beispiel Kanton Graubünden (Bezirksebene)")
|
||||
#dis.plot(dt.dis$bfs_nr, dt.dis$values, 2016, cantons = c("GR"),
|
||||
# lakes = c("none"),
|
||||
# title = "Beispiel Kanton Graubünden (Bezirksebene)")
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue