Preliminary visual exploration of data. > Click code to see how it was done
The data comes from samples collected as spraints: Each of them was analysed under the microscope, bones and scales identified whenever possible. Fish bones were measured and gave us the size group of the individual.
The aim of the study is to show the variability of the otter diet, both in terms of size and biodiversity.
The studied locations are:
We would expect to find differences in predation between lakes and rivers, between upper and lower courses of the rivers, and also between the two lakes, as Milada was much more recently formed than Přísečnice.
Predation should reflect the size distribution and availability of each species, so we should be able to see differences in the size distribution between stocked fish (Salmonids) and wild fish, such as Gobio sp.
Original data in wide format: One column for each observation of species and each size category
# Data----
path <- here::here("data", "krusnehory.xlsx")
raw <- path %>%
excel_sheets() %>%
set_names() %>%
map_df(read_excel, #join all sheets by row
path = path,
.id = "location") %>% #create new column with the name of the sheets
clean_names() #probably many errors, so better clean
head(raw)
## # A tibble: 6 x 213
## location stretch month season abramis alburnoides_bip~ alburnus_alburn~
## <chr> <chr> <chr> <chr> <dbl> <dbl> <dbl>
## 1 Bílina dolní April spring 0 0 0
## 2 Bílina dolní Augu~ summer 0 0 0
## 3 Bílina dolní Febr~ winter 1 4 4
## 4 Bílina dolní Janu~ winter 1 0 0
## 5 Bílina dolní July summer 0 0 0
## 6 Bílina dolní March spring 0 0 0
## # ... with 206 more variables: anguilla_anguilla <dbl>,
## # barbatula_barbatula <dbl>, barbus_barbus <dbl>, blicca_bjoerkna <dbl>,
## # carassius <dbl>, cottus <dbl>, ctenopharyngodon <dbl>, cyprinidae <dbl>,
## # cyprinus_carpio <dbl>, esox_lucius <dbl>, gobio <dbl>,
## # gasterosseus_aculeatus <dbl>, gymnocephalus <dbl>,
## # chondrostoma_nasus <dbl>, ictalurus_nebulosus <dbl>, ic_neb_5_10_cm <dbl>,
## # ic_neb_10_15_cm <dbl>, lepomis_gibbosus <dbl>, leucaspius_delineatus <dbl>,
## # leuciscus_cephalus <dbl>, leuciscus_leuciscus <dbl>, lota_lota <dbl>,
## # misgurnus_fosilis <dbl>, neogobius_melanostomus <dbl>,
## # oncorhynchus_mykkiss <dbl>, perca_fluviatilis <dbl>,
## # phoxinus_phoxinus <dbl>, pseudorasbora_parva <dbl>, rhodeus_sericeus <dbl>,
## # rutilus_rutilus <dbl>, salmonids <dbl>, salmo_trutta_fario <dbl>,
## # scardinius_erythrophtalmus <dbl>, silurus_glanis <dbl>, tinca_tinca <dbl>,
## # astacus <dbl>, molusca <dbl>, coleoptera <dbl>, odonata_larvae <dbl>,
## # insecta <dbl>, anura <dbl>, aves <dbl>, mammalia <dbl>, caudata <dbl>,
## # serpentes <dbl>, al_bi_5_10_cm <dbl>, al_bi_10_15_cm <dbl>,
## # al_al_0_5_cm <dbl>, al_al_5_10_cm <dbl>, al_al_10_15_cm <dbl>,
## # ba_ba_5_10_cm <dbl>, ba_ba_10_15_cm <dbl>, ba_ba_15_20_cm <dbl>,
## # br_br_5_10_cm <dbl>, br_br_10_15_cm <dbl>, br_br_15_20_cm <dbl>,
## # br_br_20_25_cm <dbl>, br_br_25_30_cm <dbl>, br_br_30_35_cm <dbl>,
## # br_br_35_40_cm <dbl>, br_br_40_45_cm <dbl>, ca_5_10_cm <dbl>,
## # ca_10_15_cm <dbl>, ca_15_20_cm <dbl>, ca_20_25_cm <dbl>, ca_25_30_cm <dbl>,
## # ca_30_35_cm <dbl>, ca_35_40_cm <dbl>, cg_5_10_cm <dbl>, cg_10_15_cm <dbl>,
## # cy_0_5_cm <dbl>, cy_5_10_cm <dbl>, cy_10_15_cm <dbl>, cy_15_20_cm <dbl>,
## # cy_20_25_cm <dbl>, cy_25_30_cm <dbl>, cy_30_35_cm <dbl>, cy_35_40_cm <dbl>,
## # cy_40_45_cm <dbl>, el_0_5_cm <dbl>, el_5_10_cm <dbl>, el_10_15_cm <dbl>,
## # el_15_20_cm <dbl>, el_20_25_cm <dbl>, el_25_30_cm <dbl>, el_30_35_cm <dbl>,
## # el_35_40_cm <dbl>, gg_0_5_cm <dbl>, gg_5_10_cm <dbl>, gg_10_15_cm <dbl>,
## # gg_15_20_cm <dbl>, gy_5_10_cm <dbl>, gy_10_15_cm <dbl>,
## # ch_na_5_10_cm <dbl>, ch_na_10_15_cm <dbl>, ch_na_15_20_cm <dbl>,
## # ch_na_20_25_cm <dbl>, ch_na_25_30_cm <dbl>, ch_na_30_35_cm <dbl>,
## # le_del_0_5_cm <dbl>, ...
Before the analysis we need to:
# What a mess. Let's try to tidy it.
#
# 1) separate all those columns with sizes from the species.
# 2) pivot sizes into a single column
# 3) filter by initials, add a species column for the fish with size, one by one. FUck.
tidy_size <- raw %>%
dplyr::select(location, stretch, month, season, contains("_cm")) %>%
pivot_longer(
cols = contains("cm"),
names_to = "size",
values_to = "number",
values_drop_na = TRUE
) %>% #join later with new species column below
# levels(as.factor(tidy_size$size)) # how many different sizes? jooooder
# Better redo the following code nightmare with case_when()!!
dplyr::mutate(species = ifelse(
grepl("al_bi_", size),
"Alburnoides bipunctatus",
ifelse(
grepl("al_al_", size),
"Alburnus alburnus",
ifelse(
grepl("st_tr_", size), #looks like a typing error
"Salmo trutta m. fario",
ifelse(
grepl("ab_br_", size),
"Abramis sp.",
ifelse(
grepl("ba_ba_", size),
"Barbatula barbatula",
ifelse(
grepl("br_br_", size),
"Barbus barbus",
ifelse(
grepl("ca_", size),
"Carassius sp.",
ifelse(
grepl("cg_", size),
"Ctenopharyngodon idella",
ifelse(
grepl("cy_", size),
"Cyprinus carpio",
ifelse(
grepl("ct_id_", size),
"Ctenopharyngodon idella",
ifelse(
grepl("ga_ac", size),
"Gasterosteus aculeatus",
ifelse(
grepl("ch_na_", size),
"Chondrostoma nasus",
ifelse(
grepl("el_", size),
"Esox lucius",
ifelse(
grepl("gg_", size),
"Gobio a Romanogobio sp.",
ifelse(
grepl("gy_", size),
"Gymnocephalus cernua",
ifelse(
grepl("ic_neb_", size),
"Ictalurus nebulosus",
ifelse(
grepl("le_ce_", size),
"Squalius cephalus",
ifelse(
grepl("le_del_", size),
"Leucaspius delineatus",
ifelse(
grepl("le_gi_", size),
"Lepomis gibbosus",
ifelse(
grepl("le_le_", size),
"Leuciscus leuciscus",
ifelse(
grepl("lo_lo_", size),
"Lota lota",
ifelse(
grepl("mi_fo_", size),
"Misgurnus fosilis",
ifelse(
grepl("neog_mel_", size),
"Neogobius melanostomus",
ifelse(
grepl("on_myk_", size),
"Oncorhynchus mykiss",
ifelse(
grepl("pf_", size),
"Perca fluviatilis",
ifelse(
grepl("ph_ph_", size),
"Phoxinus phoxinus",
ifelse(
grepl("pp_", size),
"Pseudorasbora parva",
ifelse(
grepl("rs_", size),
"Rhodeus sericeus",
ifelse(
grepl("rr_", size),
"Rutilus rutilus",
ifelse(
grepl("sa_", size),
"Salmonids",
ifelse(
grepl("se_", size),
"Scardinius erythrophtalmus",
ifelse(
grepl("si_gl_", size),
"Silurus glanis",
ifelse(
grepl("sl_tr_", size),
"Salmo trutta m. fario",
ifelse(
grepl("st_luc_", size),
"Stizostedion lucioperca",
ifelse(grepl("tt_", size), "Tinca tinca", "error") #adding option for error in case I missed a name
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
))
head(tidy_size)
## # A tibble: 6 x 7
## location stretch month season size number species
## <chr> <chr> <chr> <chr> <chr> <dbl> <chr>
## 1 Bílina dolní April spring ic_neb_5_10_cm 0 Ictalurus nebulosus
## 2 Bílina dolní April spring ic_neb_10_15_cm 0 Ictalurus nebulosus
## 3 Bílina dolní April spring al_bi_5_10_cm 0 Alburnoides bipunctatus
## 4 Bílina dolní April spring al_bi_10_15_cm 0 Alburnoides bipunctatus
## 5 Bílina dolní April spring al_al_0_5_cm 0 Alburnus alburnus
## 6 Bílina dolní April spring al_al_5_10_cm 0 Alburnus alburnus
########################## PREVIOUS ATTEMPTS, DON'T RUN ######################
# pivot_longer(
# cols = Abramis:"Stizostedion lucioperca",
# names_to = "species",
# values_to = "numberPrey",
# values_drop_na = TRUE
# )
#
#
#
#
# pivot_longer(
# cols = contains("cm"),
# names_to = "size",
# values_to = "number",
# values_drop_na = TRUE
# ) %>% # nooooooooo! hay que hacerlo manual, cada size with its species
# dplyr::filter(number > 0) %>%
# dplyr::mutate(size = str_remove_all(size, "[*a-zA-Z]")) %>% #fuck regular expressions
# dplyr::mutate (size = glue("{size}cm")) %>% #had to install dev version of dplyr
# dplyr::mutate(size = str_trim(size)) %>% #remove extra space
# dplyr::mutate(size = fct_relevel(size, "5-10 cm", after = 1)) %>%
# uncount(number) %>% # to get individual observations!!
# pivot_longer(
# cols = Abramis:"Stizostedion lucioperca",
# names_to = "species",
# values_to = "numberPrey",
# values_drop_na = TRUE
# )
#
# glimpse(tidy)
# str(tidy)
#
# colourCount = length(unique(tidy$size))
# getPalette = colorRampPalette(brewer.pal(9, "OrRd")[2:9])
The data is now in long format (Just need to “uncount” the “number” column in the next step). Now we need to:
Add the rest of the species without size measurements
To do that, we need to select them from raw and pivot them to get the number too.
Bind row to tidy_size
Clean the size variable
Rejoice
# OK, kousek po kousku. Now we have to:
#
# 4) add the rest of the species without size measurements
# 4.1) To do that, we need to select them from raw and pivot them to get the number too.
#
# 5) bind row to tidy_size
# 6) clean the size variable
# 7) Rejoice
extra_sp <- raw %>%
dplyr::select(location, stretch, month, season, anguilla_anguilla, cyprinidae, astacus:serpentes) %>%
pivot_longer(
cols = c("anguilla_anguilla", "cyprinidae", astacus:serpentes),
names_to = "species",
values_to = "number",
values_drop_na = TRUE
)
tidy_db <- bind_rows(tidy_size, extra_sp) %>%
dplyr::filter(number > 0) %>%
dplyr::mutate(size = str_remove_all(size, "[*a-zA-Z_]")) %>%
dplyr::mutate(size = dplyr::recode(size,
"05" = "0-5 cm",
"510" = "5-10 cm",
"1015" = "10-15 cm",
"1520" = "15-20 cm",
"2025" = "20-25 cm",
"2530" = "25-30 cm",
"3035" = "30-35 cm",
"35-40" = "35-40 cm",
"4045" = "40-45 cm"
)) %>%
dplyr::mutate(size = fct_relevel(size, "5-10 cm", after = 1)) %>%
uncount(number) %>% # to get individual observations!!
dplyr::mutate(species = str_to_sentence(species)) %>%
dplyr::mutate(species = dplyr::recode(species,
"Astacus" = "Astacoidea",
"Anguilla_anguilla" = "Anguilla anguilla",
"Salmo trutta m. fario" = "Salmonids",
"Oncorhynchus mykiss" = "Salmonids",
"Cyprinidae" = "Unidentified Cyprinidae",
"Alburnoides bipunctatus" = "Alburnus alburnus",
"Gobio a romanogobio sp." = "Gobio a Romanogobio sp."
)) %>% # Trouts pooled into salmonids, Alburnoides into alburnus
dplyr::mutate(stretch = dplyr::recode(stretch,
"dolní" = "Lower",
"horní" = "Upper")) %>%
dplyr::mutate(species = as.factor(species)) %>%
dplyr::mutate(stretch = as.factor(stretch)) %>%
dplyr::mutate(species = fct_relevel(species, "Aves", after = Inf)) %>%
dplyr::mutate(species = fct_relevel(species, "Insecta", after = Inf)) %>%
dplyr::mutate(species = fct_relevel(species, "Mammalia", after = Inf)) %>%
dplyr::mutate(species = fct_relevel(species, "Anura", after = Inf)) %>%
dplyr::mutate(species = fct_relevel(species, "Serpentes", after = Inf)) %>%
dplyr::mutate(species = fct_relevel(species, "Astacoidea", after = Inf)) %>%
dplyr::mutate(season = dplyr::recode(season,
"winter" = "Winter",
"spring" = "Spring",
"summer" = "Summer",
"autumn" = "Autumn")) %>%
dplyr::mutate(season = as.factor(season)) %>%
dplyr::mutate(season = fct_relevel(season, "Spring", "Summer", "Autumn", "Winter" )) %>%
dplyr::mutate(location = as.factor(location)) %>%
# Divide streams into Upper and lower and removing variable stretch
dplyr::mutate(location = case_when(location == "Bílina" & stretch == "Upper" ~ "Horní Bílina",
location == "Bílina" & stretch == "Lower" ~ "Dolní Bílina",
location == "Chomutovka" & stretch == "Lower" ~ "Dolní Chomutovka",
location == "Chomutovka" & stretch == "Upper" ~ "Horní Chomutovka",
location == "Prisecnice" ~ "Přísečnice",
TRUE ~ "jezero Milada")) %>%
dplyr::mutate(location = as.factor(location)) %>%
dplyr::select(-stretch)
summary(tidy_db)
## location month season size
## Dolní Bílina :522 Length:1725 Spring:420 5-10 cm :693
## Dolní Chomutovka:149 Class :character Summer:399 10-15 cm:405
## Horní Bílina :129 Mode :character Autumn:555 15-20 cm: 75
## Horní Chomutovka:173 Winter:351 20-25 cm: 34
## jezero Milada :386 25-30 cm: 12
## Přísečnice :366 (Other) : 10
## NA's :496
## species
## Salmonids :310
## Gobio a Romanogobio sp.:255
## Perca fluviatilis :220
## Anura :219
## Astacoidea :154
## Unidentified Cyprinidae: 87
## (Other) :480
head(tidy_db)
## # A tibble: 6 x 5
## location month season size species
## <fct> <chr> <fct> <fct> <fct>
## 1 Dolní Bílina April Spring 10-15 cm Cyprinus carpio
## 2 Dolní Bílina April Spring 0-5 cm Gobio a Romanogobio sp.
## 3 Dolní Bílina April Spring 0-5 cm Gobio a Romanogobio sp.
## 4 Dolní Bílina April Spring 5-10 cm Gobio a Romanogobio sp.
## 5 Dolní Bílina April Spring 5-10 cm Gobio a Romanogobio sp.
## 6 Dolní Bílina April Spring 5-10 cm Gobio a Romanogobio sp.
write.csv2(tidy_db,"dataShiny/tidy_db", row.names = FALSE)
lumped_fish <- tidy_db %>%
dplyr::mutate(species = case_when(
species == "Aves" ~ "Aves",
species == "Insecta" ~ 'Insecta',
species == "Mammalia" ~ 'Mammalia',
species == "Anura" ~ 'Anura',
species == "Serpentes" ~ 'Serpentes',
species == "Astacoidea" ~ 'Astacoidea',
TRUE ~ 'Fish' ))
head(lumped_fish)
## # A tibble: 6 x 5
## location month season size species
## <fct> <chr> <fct> <fct> <chr>
## 1 Dolní Bílina April Spring 10-15 cm Fish
## 2 Dolní Bílina April Spring 0-5 cm Fish
## 3 Dolní Bílina April Spring 0-5 cm Fish
## 4 Dolní Bílina April Spring 5-10 cm Fish
## 5 Dolní Bílina April Spring 5-10 cm Fish
## 6 Dolní Bílina April Spring 5-10 cm Fish
write.csv2(lumped_fish,"dataShiny/lumped_fish", row.names = FALSE)
The category “Salmonids” includes Salmo trutta m.fario, Oncorhynchus mykiss and unidentified salmonids.
Number of individual prey found in spraints in each location
total_prey <- tidy_db %>%
dplyr::select(location, species) %>%
dplyr::count(species, location) %>%
pivot_wider(names_from = location, values_from = n ) %>%
replace(is.na(.), 0)
kable(total_prey, align = "lccrr") %>%
kableExtra::kable_styling()
| species | Dolní Bílina | Dolní Chomutovka | Horní Chomutovka | Horní Bílina | jezero Milada | Přísečnice |
|---|---|---|---|---|---|---|
| Abramis sp. | 3 | 0 | 0 | 0 | 0 | 0 |
| Alburnus alburnus | 8 | 0 | 0 | 0 | 0 | 0 |
| Anguilla anguilla | 3 | 0 | 0 | 0 | 0 | 0 |
| Barbatula barbatula | 2 | 18 | 1 | 0 | 0 | 0 |
| Barbus barbus | 5 | 0 | 0 | 0 | 0 | 0 |
| Carassius sp. | 24 | 5 | 1 | 6 | 0 | 0 |
| Ctenopharyngodon idella | 0 | 1 | 3 | 0 | 1 | 0 |
| Cyprinus carpio | 59 | 5 | 2 | 0 | 2 | 0 |
| Esox lucius | 0 | 1 | 0 | 0 | 0 | 0 |
| Gobio a Romanogobio sp. | 200 | 21 | 1 | 0 | 1 | 32 |
| Gymnocephalus cernua | 2 | 0 | 0 | 0 | 21 | 0 |
| Ictalurus nebulosus | 1 | 0 | 0 | 0 | 0 | 0 |
| Lepomis gibbosus | 5 | 0 | 0 | 0 | 8 | 0 |
| Lota lota | 0 | 0 | 0 | 0 | 0 | 1 |
| Perca fluviatilis | 5 | 9 | 1 | 1 | 200 | 4 |
| Phoxinus phoxinus | 0 | 0 | 0 | 0 | 0 | 9 |
| Pseudorasbora parva | 31 | 13 | 0 | 0 | 0 | 0 |
| Rutilus rutilus | 26 | 3 | 2 | 1 | 2 | 5 |
| Salmonids | 1 | 7 | 119 | 57 | 5 | 121 |
| Scardinius erythrophtalmus | 4 | 1 | 0 | 1 | 32 | 0 |
| Silurus glanis | 4 | 1 | 0 | 0 | 2 | 2 |
| Squalius cephalus | 32 | 28 | 0 | 0 | 1 | 2 |
| Tinca tinca | 11 | 1 | 0 | 0 | 45 | 0 |
| Unidentified Cyprinidae | 39 | 14 | 4 | 4 | 22 | 4 |
| Aves | 7 | 2 | 0 | 0 | 5 | 0 |
| Insecta | 1 | 0 | 0 | 1 | 5 | 2 |
| Mammalia | 0 | 3 | 0 | 0 | 0 | 1 |
| Anura | 45 | 14 | 38 | 39 | 13 | 70 |
| Serpentes | 3 | 2 | 0 | 0 | 1 | 0 |
| Astacoidea | 1 | 0 | 1 | 19 | 20 | 113 |
#Create custom palette
#
seed <- c("#ff0000", "#00ff00", "#0000ff")
species_v <- levels(tidy_db$species)
species_vector<- c(species_v, "Other")
# names(palette1) = species_vector
species_colors = setNames(object = createPalette(31, seed, prefix="mine"), nm = species_vector)
swatch(species_colors)
#print(species_colors)
tidy_db %>%
mutate(species = fct_reorder(species, desc(species))) %>%
ggplot(aes(x = location, fill=species)) +
scale_fill_manual(values= species_colors) +
#facet_grid(. ~ season)+
geom_bar()+
theme_bw() +
scale_y_continuous("Samples collected") +
scale_x_discrete("") +
labs(fill = "Species") +
#theme(axis.text.x = element_text(angle = 90)) +
coord_flip() +
labs(title = "Krusne Hory") +
#scale_fill_discrete(drop=FALSE) +
theme(axis.text.x = element_text(size = 10)) +
theme(axis.title.x = element_text(size = 15)) +
theme(axis.title.y = element_text(size = 15)) +
theme(plot.title = element_text(size = 15))+
guides(fill = guide_legend(reverse = TRUE))
(Lumping 5% less common)
tidy_db %>%
# group by location before lumping so that 0.05 applies to each separately
dplyr::group_by(location) %>%
mutate(species = fct_lump_prop(species,0.05)) %>%
ungroup() %>%
mutate(species = fct_reorder(species, desc(species))) %>%
dplyr::mutate(species = fct_relevel(species, "Astacoidea", "Anura", after = Inf)) %>%
dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
dplyr::mutate(location = fct_relevel(location, "jezero Milada", after = 0)) %>%
ggplot(aes(x = location, fill=species)) +
scale_fill_manual(values= species_colors) +
facet_wrap(. ~ season)+
geom_bar()+
theme_bw() +
scale_y_continuous("Identified prey") +
scale_x_discrete("") +
labs(fill = "Species") +
#theme(axis.text.x = element_text(angle = 90)) +
coord_flip() +
labs(title = "Krusne Hory: Most common prey by season") +
# scale_fill_brewer(palette = "Paired") +
# scale_fill_discrete(drop=FALSE) +
theme(axis.text.x = element_text(size = 10)) +
theme(axis.title.x = element_text(size = 15)) +
theme(axis.title.y = element_text(size = 15)) +
theme(plot.title = element_text(size = 15))+
guides(fill = guide_legend(reverse = TRUE))
# tidy_db %>%
# # group by stretch and location before lumping so that 0.05 applies to each stretch separatedly
# # dplyr::group_by(stretch,location) %>%
# # mutate(species = fct_lump_prop(species,0.05)) %>%
# # ungroup() %>%
# # mutate(species = fct_reorder(species, desc(species))) %>%
# # dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
# ggplot(aes(x = location, fill=species)) +
# facet_grid(. ~ season)+
# scale_fill_discrete(drop=FALSE) +
# scale_y_continuous("Proportion of species") +
# scale_x_discrete("") +
# geom_bar(position = "fill") +
# labs(fill = "Species proportion") +
# # theme(axis.text.x = element_text(angle = 90)) +
# coord_flip() +
# labs(title = "Krusne Hory")
tidy_db %>%
# group by stretch and location before lumping so that 0.05 applies to each stretch separatedly
dplyr::group_by(location) %>%
mutate(species = fct_lump_prop(species,0.05)) %>%
ungroup() %>%
mutate(species = fct_reorder(species, desc(species))) %>%
dplyr::mutate(species = fct_relevel(species, "Astacoidea", "Anura", after = Inf)) %>%
dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
dplyr::mutate(location = fct_relevel(location, "jezero Milada", after = 0)) %>%
ggplot(aes(x = location, fill=species)) +
scale_fill_manual(values= species_colors) +
#facet_grid(. ~ season)+
scale_y_continuous("Proportion of species", labels = scales::percent) +
scale_x_discrete("") +
geom_bar(position = "fill") +
labs(fill = "Species proportion") +
# theme(axis.text.x = element_text(angle = 90)) +
labs(title = "Krusne Hory: Most common prey, year round") +
coord_flip()+
guides(fill = guide_legend(reverse = TRUE))
lumped_fish %>%
mutate(species = fct_relevel(species,"Fish")) %>%
dplyr::mutate(location = fct_relevel(location, "jezero Milada", after = 0)) %>%
ggplot(aes(x = location, fill=species)) +
#facet_grid(. ~ season)+
scale_fill_discrete(drop=FALSE) +
scale_y_continuous("Proportion of species", labels = scales::percent) +
scale_x_discrete("") +
geom_bar(position = "fill") +
labs(fill = "Species proportion") +
scale_fill_brewer(palette = "Paired") +
# theme(axis.text.x = element_text(angle = 90)) +
labs(title = "Krusne Hory") +
coord_flip() +
guides(fill = guide_legend(reverse = TRUE))
lumped_fish %>%
mutate(species = fct_relevel(species,"Fish")) %>%
dplyr::mutate(location = fct_relevel(location, "jezero Milada", after = 0)) %>%
ggplot(aes(x = location, fill=species)) +
facet_wrap(. ~ season)+
scale_fill_discrete(drop=FALSE) +
scale_y_continuous("Proportion of species", labels = scales::percent) +
scale_x_discrete("") +
geom_bar(position = "fill") +
labs(fill = "Species proportion") +
scale_fill_brewer(palette = "Paired") +
# theme(axis.text.x = element_text(angle = 90)) +
labs(title = "Krusne Hory") +
coord_flip()+
guides(fill = guide_legend(reverse = TRUE))
(Data not lumped)
hBilina <- tidy_db %>%
filter(location == "Horní Bílina")
# hBilina %>%
# #mutate(species = fct_lump_prop(species,0.05)) %>%
# mutate(species = fct_reorder(species, desc(species))) %>%
# dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
# ggplot(aes(x =location , fill = species)) +
# scale_fill_discrete(drop = TRUE) +
# scale_y_continuous("") +
# scale_x_discrete("") +
# geom_bar(position = "fill") +
# labs(fill = "Species") +
# #theme(axis.text.x = element_text(angle = 90)) +
# labs(title = "Diet: Species proportion in Upper and Lower Bílina") +
# coord_flip() +
# theme(axis.text.x = element_text(size = 10)) +
# theme(axis.title.x = element_text(size = 15)) +
# theme(axis.title.y = element_text(size = 15)) +
# theme(plot.title = element_text(size = 15))
hBilina %>%
#mutate(species = fct_lump_prop(species,0.05)) %>%
#dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
mutate(species = fct_infreq(species)) %>%
ggplot( aes(x= species, group = location), show.legend = FALSE) +
geom_bar(aes(y = ..prop.., fill = factor(..x..)), stat="count", show.legend = FALSE) +
geom_text(aes( label = scales::percent(..prop..,accuracy = 2L),
y= ..prop.. ), stat= "count", vjust = -0.5, hjust = -0.1) +
labs(y = "", x ="") +
coord_flip() +
labs(title = "Horní Bílina: Percentage of each prey group") +
scale_y_continuous(labels = scales::percent_format(accuracy = 1L))
I would say it’s only relevant to compare Spring, Summer and Autumn, because there are just 5 observations in Winter.
hBilina %>%
#mutate(species = fct_lump_prop(species,0.05)) %>%
mutate(species = fct_reorder(species, desc(species))) %>%
# dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
ggplot(aes(x = season , fill = species)) +
scale_fill_discrete(drop = TRUE) +
scale_y_continuous("Species proportion") +
scale_x_discrete("") +
geom_bar(position = "fill") +
labs(fill = "Species") +
# theme(axis.text.x = element_text(angle = 90)) +
labs(title = "Horní Bílina: Diet by Season") +
coord_flip() +
theme(axis.text.x = element_text(size = 10)) +
theme(axis.title.x = element_text(size = 15)) +
theme(axis.title.y = element_text(size = 15)) +
theme(plot.title = element_text(size = 15))+
guides(fill = guide_legend(reverse = TRUE))
hBilina %>%
dplyr::filter(season != "Winter") %>%
#mutate(species = fct_lump_prop(species,0.05)) %>%
mutate(species = fct_reorder(species, desc(species))) %>%
# dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
ggplot(aes(x = season , fill = species)) +
scale_fill_discrete(drop = TRUE) +
scale_y_continuous("Species proportion") +
scale_x_discrete("") +
geom_bar(position = "fill") +
labs(fill = "Species") +
# theme(axis.text.x = element_text(angle = 90)) +
labs(title = "Horní Bílina: Diet by Season (no winter)") +
coord_flip() +
theme(axis.text.x = element_text(size = 10)) +
theme(axis.title.x = element_text(size = 15)) +
theme(axis.title.y = element_text(size = 15)) +
theme(plot.title = element_text(size = 15))+
guides(fill = guide_legend(reverse = TRUE))
hBilina %>%
#mutate(species = fct_lump_prop(species,0.05)) %>%
dplyr::filter(season != "Winter") %>%
#dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
mutate(species = fct_infreq(species)) %>%
ggplot( aes(x= species, group = location), show.legend = FALSE) +
geom_bar(aes(y = ..prop.., fill = factor(..x..)), stat="count", show.legend = FALSE) +
geom_text(aes( label = scales::percent(..prop..,accuracy = 2L),
y= ..prop.. ), stat= "count", vjust = -0.5, hjust = -0.1) +
labs(y = "", x ="") +
facet_wrap(~ season,scales = "free") +
coord_flip() +
labs(title = "Horní Bílina: Otter diet by season") +
scale_y_continuous(labels = scales::percent_format(accuracy = 1L))
hBilina %>%
#mutate(species = fct_lump_prop(species,0.05)) %>%
dplyr::filter(season != "Winter") %>%
#dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
mutate(species = fct_infreq(species)) %>%
ggplot( aes(x= species, group = location), show.legend = FALSE) +
geom_bar(aes(y = ..prop.., fill = factor(..x..)), stat="count", show.legend = FALSE) +
geom_text(aes( label = scales::percent(..prop..,accuracy = 2L),
y= ..prop.. ), stat= "count", vjust = -0.1, hjust = 0, size =2.8) +
labs(y = "", x ="") +
facet_wrap(~ season) +
coord_flip() +
labs(title = "Horní Bílina: Otter diet by season") +
scale_y_continuous(labels = scales::percent_format(accuracy = 1L))
dBilina <- tidy_db %>%
filter(location == "Dolní Bílina")
dBilina %>%
#mutate(species = fct_lump_prop(species,0.05)) %>%
#dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
mutate(species = fct_infreq(species)) %>%
ggplot( aes(x= species, group = location), show.legend = FALSE) +
geom_bar(aes(y = ..prop.., fill = factor(..x..)), stat="count", show.legend = FALSE) +
geom_text(aes( label = scales::percent(..prop..,accuracy = 2L),
y= ..prop.. ), stat= "count", vjust = -0.5, hjust = -0.1, size =3) +
labs(y = "", x ="") +
coord_flip() +
labs(title = "Dolni Bílina: Percentage of each prey group") +
scale_y_continuous(labels = scales::percent_format(accuracy = 1L))
dBilina %>%
mutate(species = fct_lump_prop(species,0.05)) %>%
#dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
mutate(species = fct_infreq(species)) %>%
ggplot( aes(x= species, group = location), show.legend = FALSE) +
geom_bar(aes(y = ..prop.., fill = factor(..x..)), stat="count", show.legend = FALSE) +
geom_text(aes( label = scales::percent(..prop..,accuracy = 2L),
y= ..prop.. ), stat= "count", vjust = -0.5, hjust = -0.1, size = 3) +
labs(y = "", x ="") +
coord_flip() +
labs(title = "Dolni Bílina: Percentage of each prey group (0.05 lumped)") +
scale_y_continuous(labels = scales::percent_format(accuracy = 1L))
dfSummary(dBilina)
## Data Frame Summary
## dBilina
## Dimensions: 522 x 5
## Duplicates: 380
##
## -----------------------------------------------------------------------------------------------------------------------
## No Variable Stats / Values Freqs (% of Valid) Graph Valid Missing
## ---- ------------- ------------------------------- -------------------- ------------------------- ---------- ----------
## 1 location 1. Doln<ed> B<ed>lina 522 (100.0%) IIIIIIIIIIIIIIIIIIII 522 0
## [factor] 2. Doln<ed> Chomutovka 0 ( 0.0%) (100%) (0%)
## 3. Horn<ed> B<ed>lina 0 ( 0.0%)
## 4. Horn<ed> Chomutovka 0 ( 0.0%)
## 5. jezero Milada 0 ( 0.0%)
## 6. P<f8><ed>se<e8>nice 0 ( 0.0%)
##
## 2 month 1. April 58 (11.1%) II 522 0
## [character] 2. August 102 (19.5%) III (100%) (0%)
## 3. February 104 (19.9%) III
## 4. January 58 (11.1%) II
## 5. July 34 ( 6.5%) I
## 6. March 30 ( 5.8%) I
## 7. November 104 (19.9%) III
## 8. September 32 ( 6.1%) I
##
## 3 season 1. Spring 88 (16.9%) III 522 0
## [factor] 2. Summer 136 (26.1%) IIIII (100%) (0%)
## 3. Autumn 136 (26.1%) IIIII
## 4. Winter 162 (31.0%) IIIIII
##
## 4 size 1. 0-5 cm 3 ( 0.7%) 423 99
## [factor] 2. 5-10 cm 192 (45.4%) IIIIIIIII (81.03%) (18.97%)
## 3. 10-15 cm 182 (43.0%) IIIIIIII
## 4. 15-20 cm 23 ( 5.4%) I
## 5. 20-25 cm 16 ( 3.8%)
## 6. 25-30 cm 5 ( 1.2%)
## 7. 30-35 cm 0 ( 0.0%)
## 8. 40-45 cm 2 ( 0.5%)
##
## 5 species 1. Abramis sp. 3 ( 0.6%) 522 0
## [factor] 2. Alburnus alburnus 8 ( 1.5%) (100%) (0%)
## 3. Anguilla anguilla 3 ( 0.6%)
## 4. Barbatula barbatula 2 ( 0.4%)
## 5. Barbus barbus 5 ( 1.0%)
## 6. Carassius sp. 24 ( 4.6%)
## 7. Ctenopharyngodon idella 0 ( 0.0%)
## 8. Cyprinus carpio 59 (11.3%) II
## 9. Esox lucius 0 ( 0.0%)
## 10. Gobio a Romanogobio sp. 200 (38.3%) IIIIIII
## [ 20 others ] 218 (41.8%) IIIIIIII
## -----------------------------------------------------------------------------------------------------------------------
dBilina %>%
mutate(species = fct_lump_prop(species,0.05)) %>%
# dplyr::filter(season != "Winter") %>%
#dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
mutate(species = fct_infreq(species)) %>%
ggplot( aes(x= species, group = location), show.legend = FALSE) +
geom_bar(aes(y = ..prop.., fill = factor(..x..)), stat="count", show.legend = FALSE) +
geom_text(aes( label = scales::percent(..prop..,accuracy = 2L),
y= ..prop.. ), stat= "count", vjust = -0.5, hjust = -0.1) +
labs(y = "", x ="") +
facet_wrap(~ season) +
coord_flip() +
labs(title = "Doln Bílina: Otter diet by season") +
scale_y_continuous(labels = scales::percent_format(accuracy = 1L))
Water reservoir for human consumption.
pris <- tidy_db %>%
filter(location == "Přísečnice")
pris %>%
#mutate(species = fct_lump_prop(species,0.05)) %>%
#dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
mutate(species = fct_infreq(species)) %>%
ggplot( aes(x= species, group = location), show.legend = FALSE) +
geom_bar(aes(y = ..prop.., fill = factor(..x..)), stat="count", show.legend = FALSE) +
geom_text(aes( label = scales::percent(..prop..,accuracy = 2L),
y= ..prop.. ), stat= "count", vjust = -0.5, hjust = -0.1, size=3) +
labs(y = "", x ="") +
coord_flip() +
labs(title = "Přísečnice: Percentage of each prey group") +
scale_y_continuous(labels = scales::percent_format(accuracy = 1L))
pris %>%
mutate(species = fct_lump_prop(species,0.05)) %>%
#dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
mutate(species = fct_infreq(species)) %>%
ggplot( aes(x= species, group = location), show.legend = FALSE) +
geom_bar(aes(y = ..prop.., fill = factor(..x..)), stat="count", show.legend = FALSE) +
geom_text(aes( label = scales::percent(..prop..,accuracy = 2L),
y= ..prop.. ), stat= "count", vjust = -0.5, hjust = -0.1, size = 3) +
labs(y = "", x ="") +
coord_flip() +
labs(title = "Přísečnice: Percentage of each prey group (0.05 lumped)") +
scale_y_continuous(labels = scales::percent_format(accuracy = 1L))
#
Probably wise not to plot winter. Spring/summer vs Autumn also quite unbalanced.
dfSummary(pris)
## Data Frame Summary
## pris
## Dimensions: 366 x 5
## Duplicates: 301
##
## --------------------------------------------------------------------------------------------------------------------
## No Variable Stats / Values Freqs (% of Valid) Graph Valid Missing
## ---- ------------- ------------------------------- -------------------- ---------------------- ---------- ----------
## 1 location 1. Doln<ed> B<ed>lina 0 ( 0.0%) 366 0
## [factor] 2. Doln<ed> Chomutovka 0 ( 0.0%) (100%) (0%)
## 3. Horn<ed> B<ed>lina 0 ( 0.0%)
## 4. Horn<ed> Chomutovka 0 ( 0.0%)
## 5. jezero Milada 0 ( 0.0%)
## 6. P<f8><ed>se<e8>nice 366 (100.0%) IIIIIIIIIIIIIIIIIIII
##
## 2 month 1. April 43 (11.8%) II 366 0
## [character] 2. August 20 ( 5.5%) I (100%) (0%)
## 3. February 28 ( 7.6%) I
## 4. January 12 ( 3.3%)
## 5. July 41 (11.2%) II
## 6. March 31 ( 8.5%) I
## 7. November 127 (34.7%) IIIIII
## 8. September 64 (17.5%) III
##
## 3 season 1. Spring 74 (20.2%) IIII 366 0
## [factor] 2. Summer 61 (16.7%) III (100%) (0%)
## 3. Autumn 191 (52.2%) IIIIIIIIII
## 4. Winter 40 (10.9%) II
##
## 4 size 1. 0-5 cm 1 ( 0.6%) 176 190
## [factor] 2. 5-10 cm 116 (65.9%) IIIIIIIIIIIII (48.09%) (51.91%)
## 3. 10-15 cm 41 (23.3%) IIII
## 4. 15-20 cm 10 ( 5.7%) I
## 5. 20-25 cm 3 ( 1.7%)
## 6. 25-30 cm 4 ( 2.3%)
## 7. 30-35 cm 1 ( 0.6%)
## 8. 40-45 cm 0 ( 0.0%)
##
## 5 species 1. Abramis sp. 0 ( 0.0%) 366 0
## [factor] 2. Alburnus alburnus 0 ( 0.0%) (100%) (0%)
## 3. Anguilla anguilla 0 ( 0.0%)
## 4. Barbatula barbatula 0 ( 0.0%)
## 5. Barbus barbus 0 ( 0.0%)
## 6. Carassius sp. 0 ( 0.0%)
## 7. Ctenopharyngodon idella 0 ( 0.0%)
## 8. Cyprinus carpio 0 ( 0.0%)
## 9. Esox lucius 0 ( 0.0%)
## 10. Gobio a Romanogobio sp. 32 ( 8.7%) I
## [ 20 others ] 334 (91.3%) IIIIIIIIIIIIIIIIII
## --------------------------------------------------------------------------------------------------------------------
pris %>%
#mutate(species = fct_lump_prop(species,0.05)) %>%
dplyr::filter(season != "Winter") %>%
#dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
mutate(species = fct_infreq(species)) %>%
ggplot( aes(x= species, group = location), show.legend = FALSE) +
geom_bar(aes(y = ..prop.., fill = factor(..x..)), stat="count", show.legend = FALSE) +
geom_text(aes( label = scales::percent(..prop..,accuracy = 1L),
y= ..prop.. ), stat= "count", vjust = 0, hjust = -0.1) +
labs(y = "", x ="") +
facet_wrap(~ season) +
coord_flip() +
labs(title = "Přísečnice: Otter diet by season") +
scale_y_continuous(labels = scales::percent_format(accuracy = 1L))
pris %>%
mutate(species = fct_lump_prop(species,0.05)) %>%
dplyr::filter(season != "Winter") %>%
#dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
mutate(species = fct_infreq(species)) %>%
ggplot( aes(x= species, group = location), show.legend = FALSE) +
geom_bar(aes(y = ..prop.., fill = factor(..x..)), stat="count", show.legend = FALSE) +
geom_text(aes( label = scales::percent(..prop..,accuracy = 1L),
y= ..prop.. ), stat= "count", vjust = 0, hjust = -0.1) +
labs(y = "", x ="") +
facet_wrap(~ season) +
coord_flip() +
labs(title = "Přísečnice: Otter diet by season (0.05 lumped)") +
scale_y_continuous(labels = scales::percent_format(accuracy = 1L))
jez <- tidy_db %>%
filter(location == "jezero Milada")
jez %>%
mutate(species = fct_infreq(species)) %>%
mutate(species = fct_lump_prop(species,0.05)) %>%
ggplot( aes(x= species, group = location), show.legend = FALSE) +
geom_bar(aes(y = ..prop.., fill = factor(..x..)), stat="count", show.legend = FALSE) +
geom_text(aes( label = scales::percent(..prop..,accuracy = 2L),
y= ..prop.. ), stat= "count", vjust = -0.2, hjust = -0.1, size= 3) +
labs(y = "", x ="") +
coord_flip() +
labs(title = "Jezero Milada: Percentage of each prey in the diet") +
scale_y_continuous(labels = scales::percent_format(accuracy = 2L))
jez %>%
mutate(species = fct_infreq(species)) %>%
#mutate(species = fct_lump_prop(species,0.05)) %>%
ggplot( aes(x= species, group = location), show.legend = FALSE) +
geom_bar(aes(y = ..prop.., fill = factor(..x..)), stat="count", show.legend = FALSE) +
geom_text(aes( label = scales::percent(..prop..,accuracy = 2L),
y= ..prop.. ), stat= "count", vjust = 0, hjust = -0.1, size= 3) +
labs(y = "", x ="") +
coord_flip() +
labs(title = "Jezero Milada: Percentage of each prey in the diet") +
scale_y_continuous(labels = scales::percent_format(accuracy = 2L))
Perhaps we can plot winter.
dfSummary(jez)
## Data Frame Summary
## jez
## Dimensions: 386 x 5
## Duplicates: 308
##
## --------------------------------------------------------------------------------------------------------------------
## No Variable Stats / Values Freqs (% of Valid) Graph Valid Missing
## ---- ------------- ------------------------------- -------------------- ------------------------ --------- ---------
## 1 location 1. Doln<ed> B<ed>lina 0 ( 0.0%) 386 0
## [factor] 2. Doln<ed> Chomutovka 0 ( 0.0%) (100%) (0%)
## 3. Horn<ed> B<ed>lina 0 ( 0.0%)
## 4. Horn<ed> Chomutovka 0 ( 0.0%)
## 5. jezero Milada 386 (100.0%) IIIIIIIIIIIIIIIIIIII
## 6. P<f8><ed>se<e8>nice 0 ( 0.0%)
##
## 2 month 1. April 30 ( 7.8%) I 386 0
## [character] 2. August 125 (32.4%) IIIIII (100%) (0%)
## 3. February 58 (15.0%) III
## 4. July 13 ( 3.4%)
## 5. March 50 (13.0%) II
## 6. September 110 (28.5%) IIIII
##
## 3 season 1. Spring 80 (20.7%) IIII 386 0
## [factor] 2. Summer 138 (35.8%) IIIIIII (100%) (0%)
## 3. Autumn 110 (28.5%) IIIII
## 4. Winter 58 (15.0%) III
##
## 4 size 1. 0-5 cm 2 ( 0.6%) 320 66
## [factor] 2. 5-10 cm 223 (69.7%) IIIIIIIIIIIII (82.9%) (17.1%)
## 3. 10-15 cm 76 (23.8%) IIII
## 4. 15-20 cm 13 ( 4.1%)
## 5. 20-25 cm 3 ( 0.9%)
## 6. 25-30 cm 2 ( 0.6%)
## 7. 30-35 cm 1 ( 0.3%)
## 8. 40-45 cm 0 ( 0.0%)
##
## 5 species 1. Abramis sp. 0 ( 0.0%) 386 0
## [factor] 2. Alburnus alburnus 0 ( 0.0%) (100%) (0%)
## 3. Anguilla anguilla 0 ( 0.0%)
## 4. Barbatula barbatula 0 ( 0.0%)
## 5. Barbus barbus 0 ( 0.0%)
## 6. Carassius sp. 0 ( 0.0%)
## 7. Ctenopharyngodon idella 1 ( 0.3%)
## 8. Cyprinus carpio 2 ( 0.5%)
## 9. Esox lucius 0 ( 0.0%)
## 10. Gobio a Romanogobio sp. 1 ( 0.3%)
## [ 20 others ] 382 (99.0%) IIIIIIIIIIIIIIIIIII
## --------------------------------------------------------------------------------------------------------------------
jez %>%
mutate(species = fct_reorder(species, desc(species))) %>%
mutate(species = fct_lump_prop(species,0.05)) %>%
ggplot(aes(x = season , fill = species)) +
#facet_grid(. ~ season)+
scale_fill_discrete(drop = TRUE) +
scale_y_continuous("Species proportion") +
scale_x_discrete("") +
geom_bar(position = "fill") +
labs(fill = "Species") +
#theme(axis.text.x = element_text(angle = 90)) +
labs(title = "Jezero Milada: Diet by Season") +
coord_flip() +
theme(axis.text.x = element_text(size = 10)) +
theme(axis.title.x = element_text(size = 15)) +
theme(axis.title.y = element_text(size = 15)) +
theme(plot.title = element_text(size = 15))+
guides(fill = guide_legend(reverse = TRUE))
jez %>%
mutate(species = fct_lump_prop(species,0.05)) %>%
#dplyr::filter(season != "Winter") %>%
#dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
mutate(species = fct_infreq(species)) %>%
ggplot( aes(x= species, group = location), show.legend = FALSE) +
geom_bar(aes(y = ..prop.., fill = factor(..x..)), stat="count", show.legend = FALSE) +
geom_text(aes( label = scales::percent(..prop..,accuracy = 2L),
y= ..prop.. ), stat= "count", vjust = -0.5, hjust = -0.1) +
labs(y = "", x ="") +
facet_wrap(~ season) +
coord_flip() +
labs(title = "Jezero Milada: Otter diet by season") +
scale_y_continuous(labels = scales::percent_format(accuracy = 1L))
dCho <- tidy_db %>%
filter(location == "Dolní Chomutovka")
dCho %>%
mutate(species = fct_infreq(species)) %>%
mutate(species = fct_lump_prop(species,0.05)) %>%
ggplot( aes(x= species, group = location), show.legend = FALSE) +
geom_bar(aes(y = ..prop.., fill = factor(..x..)), stat="count", show.legend = FALSE) +
geom_text(aes( label = scales::percent(..prop..,accuracy = 2L),
y= ..prop.. ), stat= "count", vjust = -0.5, hjust = -0.1) +
labs(y = "", x ="") +
coord_flip() +
labs(title = "Dolní Chomutovka: Percentage of each prey in the diet") +
scale_y_continuous(labels = scales::percent_format(accuracy = 1L))
dCho %>%
mutate(species = fct_infreq(species)) %>%
#mutate(species = fct_lump_prop(species,0.05)) %>%
ggplot( aes(x= species, group = location), show.legend = FALSE) +
geom_bar(aes(y = ..prop.., fill = factor(..x..)), stat="count", show.legend = FALSE) +
geom_text(aes( label = scales::percent(..prop..,accuracy = 2L),
y= ..prop.. ), stat= "count", vjust = -0.5, hjust = -0.1) +
labs(y = "", x ="") +
coord_flip() +
labs(title = "Dolní Chomutovka: Percentage of each prey in the diet") +
scale_y_continuous(labels = scales::percent_format(accuracy = 1L))
dfSummary(dCho)
## Data Frame Summary
## dCho
## Dimensions: 149 x 5
## Duplicates: 80
##
## -----------------------------------------------------------------------------------------------------------------------
## No Variable Stats / Values Freqs (% of Valid) Graph Valid Missing
## ---- ------------- ------------------------------- -------------------- ------------------------- ---------- ----------
## 1 location 1. Doln<ed> B<ed>lina 0 ( 0.0%) 149 0
## [factor] 2. Doln<ed> Chomutovka 149 (100.0%) IIIIIIIIIIIIIIIIIIII (100%) (0%)
## 3. Horn<ed> B<ed>lina 0 ( 0.0%)
## 4. Horn<ed> Chomutovka 0 ( 0.0%)
## 5. jezero Milada 0 ( 0.0%)
## 6. P<f8><ed>se<e8>nice 0 ( 0.0%)
##
## 2 month 1. April 8 ( 5.4%) I 149 0
## [character] 2. August 18 (12.1%) II (100%) (0%)
## 3. February 17 (11.4%) II
## 4. January 19 (12.8%) II
## 5. July 16 (10.7%) II
## 6. March 39 (26.2%) IIIII
## 7. November 16 (10.7%) II
## 8. September 16 (10.7%) II
##
## 3 season 1. Spring 47 (31.5%) IIIIII 149 0
## [factor] 2. Summer 34 (22.8%) IIII (100%) (0%)
## 3. Autumn 32 (21.5%) IIII
## 4. Winter 36 (24.2%) IIII
##
## 4 size 1. 0-5 cm 0 ( 0.0%) 114 35
## [factor] 2. 5-10 cm 64 (56.1%) IIIIIIIIIII (76.51%) (23.49%)
## 3. 10-15 cm 43 (37.7%) IIIIIII
## 4. 15-20 cm 2 ( 1.8%)
## 5. 20-25 cm 4 ( 3.5%)
## 6. 25-30 cm 1 ( 0.9%)
## 7. 30-35 cm 0 ( 0.0%)
## 8. 40-45 cm 0 ( 0.0%)
##
## 5 species 1. Abramis sp. 0 ( 0.0%) 149 0
## [factor] 2. Alburnus alburnus 0 ( 0.0%) (100%) (0%)
## 3. Anguilla anguilla 0 ( 0.0%)
## 4. Barbatula barbatula 18 (12.1%) II
## 5. Barbus barbus 0 ( 0.0%)
## 6. Carassius sp. 5 ( 3.4%)
## 7. Ctenopharyngodon idella 1 ( 0.7%)
## 8. Cyprinus carpio 5 ( 3.4%)
## 9. Esox lucius 1 ( 0.7%)
## 10. Gobio a Romanogobio sp. 21 (14.1%) II
## [ 20 others ] 98 (65.8%) IIIIIIIIIIIII
## -----------------------------------------------------------------------------------------------------------------------
dCho %>%
mutate(species = fct_reorder(species, desc(species))) %>%
mutate(species = fct_lump_prop(species,0.05)) %>%
ggplot(aes(x = season , fill = species)) +
#facet_grid(. ~ season)+
scale_fill_discrete(drop = TRUE) +
scale_y_continuous("Species proportion") +
scale_x_discrete("") +
geom_bar(position = "fill") +
labs(fill = "Species") +
#theme(axis.text.x = element_text(angle = 90)) +
labs(title = "Dolní Chomutovka: Diet by Season") +
coord_flip() +
theme(axis.text.x = element_text(size = 10)) +
theme(axis.title.x = element_text(size = 15)) +
theme(axis.title.y = element_text(size = 15)) +
theme(plot.title = element_text(size = 15))+
guides(fill = guide_legend(reverse = TRUE))
dCho %>%
#mutate(species = fct_lump_prop(species,0.05)) %>%
#dplyr::filter(season != "Winter") %>%
#dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
mutate(species = fct_infreq(species)) %>%
ggplot( aes(x= species, group = location), show.legend = FALSE) +
geom_bar(aes(y = ..prop.., fill = factor(..x..)), stat="count", show.legend = FALSE) +
geom_text(aes( label = scales::percent(..prop..,accuracy = 2L),
y= ..prop.. ), stat= "count", vjust = 0, hjust = -0.1,size=3) +
labs(y = "", x ="") +
facet_wrap(~ season) +
coord_flip() +
labs(title = "Dolní Chomutovka: Otter diet by season") +
scale_y_continuous(labels = scales::percent_format(accuracy = 1L))
hCho <- tidy_db %>%
filter(location == "Horní Chomutovka")
hCho %>%
mutate(species = fct_infreq(species)) %>%
# mutate(species = fct_lump_prop(species,0.05)) %>%
ggplot( aes(x= species, group = location), show.legend = FALSE) +
geom_bar(aes(y = ..prop.., fill = factor(..x..)), stat="count", show.legend = FALSE) +
geom_text(aes( label = scales::percent(..prop..,accuracy = 2L),
y= ..prop.. ), stat= "count", vjust = 0, hjust = -0.1, size=3) +
labs(y = "", x ="") +
coord_flip() +
labs(title = "Horní Chomutovka: Percentage of each prey in the diet") +
scale_y_continuous(labels = scales::percent_format(accuracy = 1L))
hCho %>%
mutate(species = fct_infreq(species)) %>%
mutate(species = fct_lump_prop(species,0.05)) %>%
ggplot( aes(x= species, group = location), show.legend = FALSE) +
geom_bar(aes(y = ..prop.., fill = factor(..x..)), stat="count", show.legend = FALSE) +
geom_text(aes( label = scales::percent(..prop..,accuracy = 2L),
y= ..prop.. ), stat= "count", vjust = -0.5, hjust = -0.1) +
labs(y = "", x ="") +
coord_flip() +
labs(title = "Horní Chomutovka: Percentage of each prey in the diet") +
scale_y_continuous(labels = scales::percent_format(accuracy = 1L))
We shouldn’t have summer into account. Autumn is also in the limit.
dfSummary(hCho)
## Data Frame Summary
## hCho
## Dimensions: 173 x 5
## Duplicates: 131
##
## -----------------------------------------------------------------------------------------------------------------------
## No Variable Stats / Values Freqs (% of Valid) Graph Valid Missing
## ---- ------------- ------------------------------- -------------------- ------------------------- ---------- ----------
## 1 location 1. Doln<ed> B<ed>lina 0 ( 0.0%) 173 0
## [factor] 2. Doln<ed> Chomutovka 0 ( 0.0%) (100%) (0%)
## 3. Horn<ed> B<ed>lina 0 ( 0.0%)
## 4. Horn<ed> Chomutovka 173 (100.0%) IIIIIIIIIIIIIIIIIIII
## 5. jezero Milada 0 ( 0.0%)
## 6. P<f8><ed>se<e8>nice 0 ( 0.0%)
##
## 2 month 1. April 63 (36.4%) IIIIIII 173 0
## [character] 2. August 4 ( 2.3%) (100%) (0%)
## 3. February 22 (12.7%) II
## 4. January 28 (16.2%) III
## 5. July 5 ( 2.9%)
## 6. March 22 (12.7%) II
## 7. November 14 ( 8.1%) I
## 8. September 15 ( 8.7%) I
##
## 3 season 1. Spring 85 (49.1%) IIIIIIIII 173 0
## [factor] 2. Summer 9 ( 5.2%) I (100%) (0%)
## 3. Autumn 29 (16.8%) III
## 4. Winter 50 (28.9%) IIIII
##
## 4 size 1. 0-5 cm 0 ( 0.0%) 130 43
## [factor] 2. 5-10 cm 69 (53.1%) IIIIIIIIII (75.14%) (24.86%)
## 3. 10-15 cm 37 (28.5%) IIIII
## 4. 15-20 cm 16 (12.3%) II
## 5. 20-25 cm 8 ( 6.2%) I
## 6. 25-30 cm 0 ( 0.0%)
## 7. 30-35 cm 0 ( 0.0%)
## 8. 40-45 cm 0 ( 0.0%)
##
## 5 species 1. Abramis sp. 0 ( 0.0%) 173 0
## [factor] 2. Alburnus alburnus 0 ( 0.0%) (100%) (0%)
## 3. Anguilla anguilla 0 ( 0.0%)
## 4. Barbatula barbatula 1 ( 0.6%)
## 5. Barbus barbus 0 ( 0.0%)
## 6. Carassius sp. 1 ( 0.6%)
## 7. Ctenopharyngodon idella 3 ( 1.7%)
## 8. Cyprinus carpio 2 ( 1.2%)
## 9. Esox lucius 0 ( 0.0%)
## 10. Gobio a Romanogobio sp. 1 ( 0.6%)
## [ 20 others ] 165 (95.4%) IIIIIIIIIIIIIIIIIII
## -----------------------------------------------------------------------------------------------------------------------
hCho %>%
mutate(species = fct_reorder(species, desc(species))) %>%
dplyr::filter(season != "Summer") %>%
#mutate(species = fct_lump_prop(species,0.05)) %>%
ggplot(aes(x = season , fill = species)) +
#facet_grid(. ~ season)+
scale_fill_discrete(drop = TRUE) +
scale_y_continuous("Species proportion") +
scale_x_discrete("") +
geom_bar(position = "fill") +
labs(fill = "Species") +
#theme(axis.text.x = element_text(angle = 90)) +
labs(title = "Horní Chomutovka: Diet by Season") +
coord_flip() +
theme(axis.text.x = element_text(size = 10)) +
theme(axis.title.x = element_text(size = 15)) +
theme(axis.title.y = element_text(size = 15)) +
theme(plot.title = element_text(size = 15))+
guides(fill = guide_legend(reverse = TRUE))
hCho %>%
#mutate(species = fct_lump_prop(species,0.05)) %>%
dplyr::filter(season != "Summer") %>%
#dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
mutate(species = fct_infreq(species)) %>%
ggplot( aes(x= species, group = location), show.legend = FALSE) +
geom_bar(aes(y = ..prop.., fill = factor(..x..)), stat="count", show.legend = FALSE) +
geom_text(aes( label = scales::percent(..prop..,accuracy = 2L),
y= ..prop.. ), stat= "count", vjust = -0, hjust = 0) +
labs(y = "", x ="") +
facet_wrap(~ season) +
coord_flip() +
labs(title = "Horní Chomutovka: Otter diet by season") +
scale_y_continuous(labels = scales::percent_format(accuracy = 1L))
Plot all together just to see if the data looks right.
tidy_db %>%
drop_na(size) %>%
# group by stretch and location before lumping so that 0.05 applies to each stretch separatedly
# dplyr::group_by(stretch,location) %>%
# mutate(species = fct_lump_prop(species,0.05)) %>%
# ungroup() %>%
# mutate(species = fct_reorder(species, desc(species))) %>%
# dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
ggplot(aes(x = species, fill=size)) +
facet_grid(. ~ location)+
geom_bar(na.rm = TRUE)+
theme_bw() +
scale_y_continuous("Samples collected") +
scale_x_discrete("") +
labs(fill = "Size Group") +
#theme(axis.text.x = element_text(angle = 90)) +
coord_flip() +
labs(title = "Krusne Hory") +
scale_fill_brewer(palette = "Paired") +
scale_fill_discrete(drop=FALSE) +
theme(axis.text.x = element_text(size = 10)) +
theme(axis.title.x = element_text(size = 15)) +
theme(axis.title.y = element_text(size = 15)) +
theme(plot.title = element_text(size = 15))
lumped_fish %>%
drop_na(size) %>%
dplyr::filter(species == "Fish") %>%
ggplot(aes(x = location, fill = size)) +
#facet_grid(. ~ location)+
geom_bar( position = "dodge")+
scale_y_continuous("") +
scale_x_discrete("") +
labs(fill = "Size") +
#theme(axis.text.x = element_text(angle = 90)) +
# coord_flip() +
labs(title = "Krusne Hory: Size distribution") +
scale_fill_brewer(palette = "Paired") +
scale_fill_discrete(drop=TRUE) +
theme(axis.text.x = element_text(size = 10)) +
theme(axis.title.x = element_text(size = 15)) +
theme(axis.title.y = element_text(size = 15)) +
theme(plot.title = element_text(size = 15))
theme(axis.title.y = element_text(size = 15)) +
theme(plot.title = element_text(size = 15))
## List of 2
## $ axis.title.y:List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : num 15
## ..$ hjust : NULL
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : NULL
## ..$ debug : NULL
## ..$ inherit.blank: logi FALSE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ plot.title :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : num 15
## ..$ hjust : NULL
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : NULL
## ..$ debug : NULL
## ..$ inherit.blank: logi FALSE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## - attr(*, "class")= chr [1:2] "theme" "gg"
## - attr(*, "complete")= logi FALSE
## - attr(*, "validate")= logi TRUE
Just the fish with size measurements, pooling 5% less common
tidy_db %>%
drop_na(size) %>%
# group by stretch and location before lumping so that 0.05 applies to each stretch separatedly
dplyr::group_by(location) %>%
mutate(species = fct_lump_prop(species,0.05)) %>%
ungroup() %>%
mutate(species = fct_reorder(species, desc(species))) %>%
dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
ggplot(aes(x = species, fill=size)) +
facet_grid(. ~ location)+
scale_fill_discrete(drop=FALSE) +
scale_y_continuous("Proportion size") +
scale_x_discrete("") +
geom_bar(position = "fill") +
labs(fill = "Size Group") +
# theme(axis.text.x = element_text(angle = 90)) +
labs(title = "Krusne Hory") +
coord_flip()
# guides(fill = guide_legend(reverse = TRUE))
hBilina %>%
drop_na(size) %>%
mutate(species = fct_lump_prop(species,0.05)) %>%
mutate(species = fct_reorder(species, desc(species))) %>%
dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
ggplot(aes(x = species, fill = size)) +
scale_fill_discrete(drop = FALSE) +
scale_y_continuous("Proportion size") +
scale_x_discrete("") +
geom_bar(position = "fill") +
labs(fill = "Size Group (cm)") +
# theme(axis.text.x = element_text(angle = 90)) +
labs(title = "Horní Bílina") +
coord_flip() +
theme(axis.text.x = element_text(size = 10)) +
theme(axis.title.x = element_text(size = 15)) +
theme(axis.title.y = element_text(size = 15)) +
theme(plot.title = element_text(size = 15))
hBilina %>%
drop_na(size) %>%
#mutate(species = fct_lump_prop(species,0.05)) %>%
mutate(species = fct_reorder(species, desc(species))) %>%
dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
ggplot(aes(x = species, fill = size)) +
scale_fill_discrete(drop = FALSE) +
scale_y_continuous("Proportion size") +
scale_x_discrete("") +
geom_bar(position = "fill") +
labs(fill = "Size Group (cm)") +
# theme(axis.text.x = element_text(angle = 90)) +
labs(title = "Horní Bílina") +
coord_flip() +
theme(axis.text.x = element_text(size = 10)) +
theme(axis.title.x = element_text(size = 15)) +
theme(axis.title.y = element_text(size = 15)) +
theme(plot.title = element_text(size = 15))
hBilina %>%
drop_na(size) %>%
mutate(species = fct_lump_prop(species,0.05)) %>%
mutate(species = fct_reorder(species, desc(species))) %>%
dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
ggplot(aes(x = species, fill = size)) +
facet_wrap(. ~ season)+
scale_fill_discrete(drop = TRUE) +
scale_y_continuous("Proportion size") +
scale_x_discrete("") +
geom_bar(position = "fill") +
labs(fill = "Size Group (cm)") +
# theme(axis.text.x = element_text(angle = 90)) +
labs(title = "Horní Bílina, diet by season") +
coord_flip() +
theme(axis.text.x = element_text(size = 10)) +
theme(axis.title.x = element_text(size = 15)) +
theme(axis.title.y = element_text(size = 15)) +
theme(plot.title = element_text(size = 15))
dBilina %>%
drop_na(size) %>%
mutate(species = fct_lump_prop(species,0.05)) %>%
mutate(species = fct_reorder(species, desc(species))) %>%
dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
ggplot(aes(x = species, fill = size)) +
scale_fill_discrete(drop = FALSE) +
scale_y_continuous("Proportion size") +
scale_x_discrete("") +
geom_bar(position = "fill") +
labs(fill = "Size Group (cm)") +
# theme(axis.text.x = element_text(angle = 90)) +
labs(title = "Dolní Bílina") +
coord_flip() +
theme(axis.text.x = element_text(size = 10)) +
theme(axis.title.x = element_text(size = 15)) +
theme(axis.title.y = element_text(size = 15)) +
theme(plot.title = element_text(size = 15))
dBilina %>%
drop_na(size) %>%
#mutate(species = fct_lump_prop(species,0.05)) %>%
mutate(species = fct_reorder(species, desc(species))) %>%
dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
ggplot(aes(x = species, fill = size)) +
scale_fill_discrete(drop = FALSE) +
scale_y_continuous("Proportion size") +
scale_x_discrete("") +
geom_bar(position = "fill") +
labs(fill = "Size Group (cm)") +
# theme(axis.text.x = element_text(angle = 90)) +
labs(title = "Dolní Bílina") +
coord_flip() +
theme(axis.text.x = element_text(size = 10)) +
theme(axis.title.x = element_text(size = 15)) +
theme(axis.title.y = element_text(size = 15)) +
theme(plot.title = element_text(size = 15))
dBilina %>%
drop_na(size) %>%
mutate(species = fct_lump_prop(species,0.05)) %>%
mutate(species = fct_reorder(species, desc(species))) %>%
dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
ggplot(aes(x = species, fill = size)) +
facet_wrap(. ~ season)+
scale_fill_discrete(drop = TRUE) +
scale_y_continuous("Proportion size") +
scale_x_discrete("") +
geom_bar(position = "fill") +
labs(fill = "Size Group (cm)") +
# theme(axis.text.x = element_text(angle = 90)) +
labs(title = "Dolní Bílina, diet by season") +
coord_flip() +
theme(axis.text.x = element_text(size = 10)) +
theme(axis.title.x = element_text(size = 15)) +
theme(axis.title.y = element_text(size = 15)) +
theme(plot.title = element_text(size = 15))
pris %>%
drop_na(size) %>%
mutate(species = fct_reorder(species, desc(species))) %>%
#mutate(species = fct_lump_prop(species,0.05)) %>%
ggplot(aes(x = species, fill=size)) +
#facet_grid(. ~ location)+
scale_fill_discrete(drop=FALSE) +
scale_y_continuous("Proportion size") +
scale_x_discrete("") +
geom_bar(position = "fill") +
labs(fill = "Size Group (cm)") +
# theme(axis.text.x = element_text(angle = 90)) +
labs(title = "Přísečnice") +
coord_flip() +
theme(axis.text.x = element_text(size = 10)) +
theme(axis.title.x = element_text(size = 15)) +
theme(axis.title.y = element_text(size = 15)) +
theme(plot.title = element_text(size = 15))
pris %>%
drop_na(size) %>%
mutate(species = fct_reorder(species, desc(species))) %>%
mutate(species = fct_lump_prop(species,0.05)) %>%
ggplot(aes(x = species, fill=size)) +
#facet_grid(. ~ location)+
scale_fill_discrete(drop=FALSE) +
scale_y_continuous("Proportion size") +
scale_x_discrete("") +
geom_bar(position = "fill") +
labs(fill = "Size Group (cm)") +
# theme(axis.text.x = element_text(angle = 90)) +
labs(title = "Přísečnice") +
coord_flip() +
theme(axis.text.x = element_text(size = 10)) +
theme(axis.title.x = element_text(size = 15)) +
theme(axis.title.y = element_text(size = 15)) +
theme(plot.title = element_text(size = 15))
pris %>%
drop_na(size) %>%
mutate(species = fct_reorder(species, desc(species))) %>%
#mutate(species = fct_lump_prop(species,0.05)) %>%
ggplot(aes(x = species, fill=size)) +
facet_wrap(. ~ season)+
scale_fill_discrete(drop=FALSE) +
scale_y_continuous("Proportion size") +
scale_x_discrete("") +
geom_bar(position = "fill") +
labs(fill = "Size Group (cm)") +
# theme(axis.text.x = element_text(angle = 90)) +
labs(title = "Přísečnice, diet by season") +
coord_flip() +
theme(axis.text.x = element_text(size = 10)) +
theme(axis.title.x = element_text(size = 15)) +
theme(axis.title.y = element_text(size = 15)) +
theme(plot.title = element_text(size = 15))
Mining recovered area
jez <- tidy_db %>%
filter(location == "jezero Milada")
jez %>%
drop_na(size) %>%
mutate(species = fct_reorder(species, desc(species))) %>%
#mutate(species = fct_lump_prop(species,0.05)) %>%
ggplot(aes(x = species, fill=size)) +
#facet_grid(. ~ location)+
scale_fill_discrete(drop=FALSE) +
scale_y_continuous("Proportion size") +
scale_x_discrete("") +
geom_bar(position = "fill") +
labs(fill = "Size Group (cm)") +
# theme(axis.text.x = element_text(angle = 90)) +
labs(title = "jezero Milada") +
coord_flip() +
theme(axis.text.x = element_text(size = 10)) +
theme(axis.title.x = element_text(size = 15)) +
theme(axis.title.y = element_text(size = 15)) +
theme(plot.title = element_text(size = 15))
jez %>%
drop_na(size) %>%
mutate(species = fct_reorder(species, desc(species))) %>%
mutate(species = fct_lump_prop(species,0.05)) %>%
ggplot(aes(x = species, fill=size)) +
#facet_grid(. ~ location)+
scale_fill_discrete(drop=FALSE) +
scale_y_continuous("Proportion size") +
scale_x_discrete("") +
geom_bar(position = "fill") +
labs(fill = "Size Group (cm)") +
# theme(axis.text.x = element_text(angle = 90)) +
labs(title = "jezero Milada") +
coord_flip() +
theme(axis.text.x = element_text(size = 10)) +
theme(axis.title.x = element_text(size = 15)) +
theme(axis.title.y = element_text(size = 15)) +
theme(plot.title = element_text(size = 15))
jez %>%
drop_na(size) %>%
mutate(species = fct_reorder(species, desc(species))) %>%
mutate(species = fct_lump_prop(species,0.05)) %>%
ggplot(aes(x = species, fill=size)) +
facet_wrap(. ~ season)+
scale_fill_discrete(drop=FALSE) +
scale_y_continuous("Proportion size") +
scale_x_discrete("") +
geom_bar(position = "fill") +
labs(fill = "Size Group (cm)") +
# theme(axis.text.x = element_text(angle = 90)) +
labs(title = "Jezero Milada, diet by season") +
coord_flip() +
theme(axis.text.x = element_text(size = 10)) +
theme(axis.title.x = element_text(size = 15)) +
theme(axis.title.y = element_text(size = 15)) +
theme(plot.title = element_text(size = 15))
hCho %>%
drop_na(size) %>%
#mutate(species = fct_lump_prop(species,0.05)) %>%
mutate(species = fct_reorder(species, desc(species))) %>%
dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
ggplot(aes(x = species, fill=size)) +
# facet_grid(. ~ stretch)+
scale_fill_discrete(drop=FALSE) +
scale_y_continuous("Proportion size") +
scale_x_discrete("") +
geom_bar(position = "fill") +
labs(fill = "Size Group (cm)") +
# theme(axis.text.x = element_text(angle = 90)) +
labs(title = "Horní Chomutovka") +
coord_flip() +
theme(axis.text.x = element_text(size = 10)) +
theme(axis.title.x = element_text(size = 15)) +
theme(axis.title.y = element_text(size = 15)) +
theme(plot.title = element_text(size = 15))
hCho %>%
drop_na(size) %>%
dplyr::filter(season != "Summer") %>%
# mutate(species = fct_lump_prop(species,0.05)) %>%
mutate(species = fct_reorder(species, desc(species))) %>%
dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
ggplot(aes(x = species, fill=size)) +
facet_wrap(. ~ season)+
scale_fill_discrete(drop=FALSE) +
scale_y_continuous("Proportion size") +
scale_x_discrete("") +
geom_bar(position = "fill") +
labs(fill = "Size Group (cm)") +
# theme(axis.text.x = element_text(angle = 90)) +
labs(title = "Horní Chomutovka, diet by season") +
coord_flip() +
theme(axis.text.x = element_text(size = 10)) +
theme(axis.title.x = element_text(size = 15)) +
theme(axis.title.y = element_text(size = 15)) +
theme(plot.title = element_text(size = 15))
dCho %>%
drop_na(size) %>%
#mutate(species = fct_lump_prop(species,0.05)) %>%
mutate(species = fct_reorder(species, desc(species))) %>%
dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
ggplot(aes(x = species, fill=size)) +
# facet_grid(. ~ stretch)+
scale_fill_discrete(drop=FALSE) +
scale_y_continuous("Proportion size") +
scale_x_discrete("") +
geom_bar(position = "fill") +
labs(fill = "Size Group (cm)") +
# theme(axis.text.x = element_text(angle = 90)) +
labs(title = "Dolní Chomutovka") +
coord_flip() +
theme(axis.text.x = element_text(size = 10)) +
theme(axis.title.x = element_text(size = 15)) +
theme(axis.title.y = element_text(size = 15)) +
theme(plot.title = element_text(size = 15))
dCho %>%
drop_na(size) %>%
# dplyr::filter(season != "Summer") %>%
# mutate(species = fct_lump_prop(species,0.05)) %>%
mutate(species = fct_reorder(species, desc(species))) %>%
dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
ggplot(aes(x = species, fill=size)) +
facet_wrap(. ~ season)+
scale_fill_discrete(drop=FALSE) +
scale_y_continuous("Proportion size") +
scale_x_discrete("") +
geom_bar(position = "fill") +
labs(fill = "Size Group (cm)") +
# theme(axis.text.x = element_text(angle = 90)) +
labs(title = "Dolní Chomutovka, diet by season") +
coord_flip() +
theme(axis.text.x = element_text(size = 10)) +
theme(axis.title.x = element_text(size = 15)) +
theme(axis.title.y = element_text(size = 15)) +
theme(plot.title = element_text(size = 15))
#filter upper
# upper <- tidy_db %>%
# dplyr::filter(stretch == "Upper")
#
#
# upper %>%
# dplyr::group_by(location) %>%
# mutate(species = fct_lump_prop(species,0.05)) %>%
# ungroup() %>%
# mutate(species = fct_reorder(species, desc(species))) %>%
# dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
# ggplot(aes(x =location , fill = species)) +
# #facet_grid(. ~ season)+
# scale_fill_discrete(drop = TRUE) +
# scale_y_continuous("") +
# scale_x_discrete("") +
# geom_bar(position = "fill") +
# labs(fill = "Species") +
# # theme(axis.text.x = element_text(angle = 90)) +
# labs(title = "Diet: Species proportion in upper courses of the streams") +
# #coord_flip() +
# theme(axis.text.x = element_text(size = 10)) +
# theme(axis.title.x = element_text(size = 15)) +
# theme(axis.title.y = element_text(size = 15)) +
# theme(plot.title = element_text(size = 15))
#
# #filter lower
#
# lower <- tidy_db %>%
# dplyr::filter(stretch == "Lower")
#
#
# lower %>%
# dplyr::group_by(location) %>%
# mutate(species = fct_lump_prop(species,0.05)) %>%
# ungroup() %>%
# mutate(species = fct_reorder(species, desc(species))) %>%
# dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
# ggplot(aes(x =location , fill = species)) +
# #facet_grid(. ~ season)+
# scale_fill_discrete(drop = TRUE) +
# scale_y_continuous("") +
# scale_x_discrete("") +
# geom_bar(position = "fill") +
# labs(fill = "Species") +
# # theme(axis.text.x = element_text(angle = 90)) +
# labs(title = "Diet: Species proportion in lower courses of the streams") +
# #coord_flip() +
# theme(axis.text.x = element_text(size = 10)) +
# theme(axis.title.x = element_text(size = 15)) +
# theme(axis.title.y = element_text(size = 15)) +
# theme(plot.title = element_text(size = 15))
#
#
# #filter upper
#
# upper <- tidy_db %>%
# dplyr::filter(stretch == "Upper")
#
#
# upper %>%
# drop_na(size) %>%
# dplyr::group_by(location) %>%
# mutate(species = fct_lump_prop(species,0.05)) %>%
# ungroup() %>%
# mutate(species = fct_reorder(species, desc(species))) %>%
# dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
# ggplot(aes(x =species , fill = size)) +
# facet_grid(. ~ location)+
# scale_fill_discrete(drop = TRUE) +
# scale_y_continuous("") +
# scale_x_discrete("") +
# geom_bar(position = "fill") +
# labs(fill = "Size") +
# # theme(axis.text.x = element_text(angle = 90)) +
# labs(title = "Diet: Size proportion in upper courses of the streams") +
# coord_flip() +
# theme(axis.text.x = element_text(size = 10)) +
# theme(axis.title.x = element_text(size = 15)) +
# theme(axis.title.y = element_text(size = 15)) +
# theme(plot.title = element_text(size = 15))
#
# #filter lower
#
# lower <- tidy_db %>%
# drop_na(size) %>%
# dplyr::filter(stretch == "Lower")
#
#
# lower %>%
# dplyr::group_by(location) %>%
# mutate(species = fct_lump_prop(species,0.05)) %>%
# ungroup() %>%
# mutate(species = fct_reorder(species, desc(species))) %>%
# dplyr::mutate(species = fct_relevel(species, "Other", after = Inf)) %>%
# ggplot(aes(x =species , fill = size)) +
# facet_grid(. ~ location)+
# scale_fill_discrete(drop = TRUE) +
# scale_y_continuous("") +
# scale_x_discrete("") +
# geom_bar(position = "fill") +
# labs(fill = "Size") +
# # theme(axis.text.x = element_text(angle = 90)) +
# labs(title = "Diet: Size proportion in lower courses of the streams") +
# coord_flip() +
# theme(axis.text.x = element_text(size = 10)) +
# theme(axis.title.x = element_text(size = 15)) +
# theme(axis.title.y = element_text(size = 15)) +
# theme(plot.title = element_text(size = 15))
tidy_db %>%
dplyr::filter(species == "Salmonids") %>%
ggplot(aes(x = species, fill = size)) +
facet_grid(. ~ location)+
geom_bar( position = "dodge")+
scale_y_continuous("") +
scale_x_discrete(labels=NULL) +
labs(fill = "Size") +
#theme(axis.text.x = element_text(angle = 90)) +
# coord_flip() +
labs(title = "Krusne Hory: Size distribution of salmonids") +
scale_fill_brewer(palette = "Paired") +
scale_fill_discrete(drop=FALSE) +
theme(axis.text.x = element_text(size = 10)) +
theme(axis.title.x = element_text(size = 15)) +
theme(axis.title.y = element_text(size = 15)) +
theme(plot.title = element_text(size = 15))
salmo_vs_gobio <- c("Salmonids", "Gobio a Romanogobio sp.")
salmo_vs_tinca <- c("Salmonids", "Tinca tinca")
salmo_vs_perca <- c("Salmonids", "Perca fluviatilis")
salmo_vs_leuciscus <- c("Salmonids", "Leuciscus cephalus")
salmo_vs_rutilus <- c("Salmonids", "Rutilus rutilus")
tidy_db %>%
dplyr::filter(species %in% salmo_vs_gobio) %>%
ggplot(aes(x = species, fill = size)) +
facet_grid(. ~ location)+
geom_bar( position = "dodge")+
scale_y_continuous("") +
scale_x_discrete("") +
labs(fill = "Size") +
#theme(axis.text.x = element_text(angle = 90)) +
# coord_flip() +
labs(title = "Krusne Hory: Size distribution of salmonids and Gobio sp") +
scale_fill_brewer(palette = "Paired") +
scale_fill_discrete(drop=FALSE) +
theme(axis.text.x = element_text(size = 10)) +
theme(axis.title.x = element_text(size = 15)) +
theme(axis.title.y = element_text(size = 15)) +
theme(plot.title = element_text(size = 15))
tidy_db %>%
dplyr::filter(species %in% salmo_vs_tinca) %>%
ggplot(aes(x = species, fill = size)) +
facet_grid(. ~ location)+
geom_bar( position = "dodge")+
scale_y_continuous("") +
scale_x_discrete("") +
labs(fill = "Size") +
#theme(axis.text.x = element_text(angle = 90)) +
# coord_flip() +
labs(title = "Krusne Hory: Size distribution of salmonids and Tinca tinca") +
scale_fill_brewer(palette = "Paired") +
scale_fill_discrete(drop=FALSE) +
theme(axis.text.x = element_text(size = 10)) +
theme(axis.title.x = element_text(size = 15)) +
theme(axis.title.y = element_text(size = 15)) +
theme(plot.title = element_text(size = 15))
tidy_db %>%
dplyr::filter(species %in% salmo_vs_perca) %>%
ggplot(aes(x = species, fill = size)) +
facet_grid(. ~ location)+
geom_bar( position = "dodge")+
scale_y_continuous("") +
scale_x_discrete("") +
labs(fill = "Size") +
#theme(axis.text.x = element_text(angle = 90)) +
coord_flip() +
labs(title = "Krusne Hory: Size distribution of salmonids and Perca fluviatilis") +
scale_fill_brewer(palette = "Paired") +
scale_fill_discrete(drop=FALSE) +
theme(axis.text.x = element_text(size = 10)) +
theme(axis.title.x = element_text(size = 15)) +
theme(axis.title.y = element_text(size = 15)) +
theme(plot.title = element_text(size = 15))
tidy_db %>%
dplyr::filter(species %in% salmo_vs_leuciscus) %>%
ggplot(aes(x = species, fill = size)) +
facet_grid(. ~ location)+
geom_bar( position = "dodge")+
scale_y_continuous("") +
scale_x_discrete("") +
labs(fill = "Size") +
#theme(axis.text.x = element_text(angle = 90)) +
coord_flip() +
labs(title = "Krusne Hory: Size distribution of salmonids and Leuciscus cephalus") +
scale_fill_brewer(palette = "Paired") +
scale_fill_discrete(drop=FALSE) +
theme(axis.text.x = element_text(size = 10)) +
theme(axis.title.x = element_text(size = 15)) +
theme(axis.title.y = element_text(size = 15)) +
theme(plot.title = element_text(size = 15))
tidy_db %>%
dplyr::filter(species %in% salmo_vs_rutilus) %>%
ggplot(aes(x = species, fill = size)) +
facet_grid(. ~ location)+
geom_bar( position = "dodge")+
scale_y_continuous("") +
scale_x_discrete("") +
labs(fill = "Size") +
#theme(axis.text.x = element_text(angle = 90)) +
# coord_flip() +
labs(title = "Krusne Hory: Size distribution of salmonids and Rutilus rutilus") +
scale_fill_brewer(palette = "Paired") +
scale_fill_discrete(drop=FALSE) +
theme(axis.text.x = element_text(size = 10)) +
theme(axis.title.x = element_text(size = 15)) +
theme(axis.title.y = element_text(size = 15)) +
theme(plot.title = element_text(size = 15))