diff --git a/.vdoc.r b/.vdoc.r
deleted file mode 100644
index c40d3ef..0000000
--- a/.vdoc.r
+++ /dev/null
@@ -1,75 +0,0 @@
-#
-#
-#
-#
-#
-#
-#
-#
-#
-#
-#
-#
-#
-#
-#
-#
-#
-#
-#
-#
-#
-#
-#
-#
-#
-#
-#
-#
-#
-#
-#
-#
-#
-#
-library(sf)
-library(ggplot2)
-library(ggiraph)
-
-# Load the shapefile
-aus_shp <- suppressWarnings(suppressMessages(st_read("../STE_2021_AUST_GDA2020.shx")[1:8,])) # remove islands
-
-# Simplify geometries with a lower tolerance and keep empty shapes
-aus_shp_simplified <- st_simplify(aus_shp, dTolerance = 8000, preserveTopology = TRUE)
-
-# Ensure geometries are valid
-aus_shp_simplified <- st_make_valid(aus_shp_simplified)
-
-# Remove empty geometries
-aus_shp_simplified <- aus_shp_simplified[!st_is_empty(aus_shp_simplified), ]
-# Generate random numbers between 1 and 100 for each state
-set.seed(123) # For reproducibility
-aus_shp_simplified$`2024 colony losses` <- sample(1:20, nrow(aus_shp_simplified), replace = TRUE)
-
-# Create ggplot object with interactive elements
-p <- ggplot(aus_shp_simplified) +
- geom_sf_interactive(aes(fill = `2024 colony losses`, tooltip = `2024 colony losses`, data_id = `2024 colony losses`)) +
- scale_fill_viridis_c() +
- theme_minimal() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), axis.text = element_blank())
-
-# Render the interactive plot
-girafe(
- ggobj = p,
- options = list(
- opts_hover(css = "fill:orange;"),
- opts_hover_inv(css = "opacity:0.5;"),
- opts_selection(type = "single", only_shiny = FALSE),
- opts_tooltip(css = "font-size: 20px;")
- )
-)
-
-#
-#
-#
-#
-#
diff --git a/_freeze/index/execute-results/html.json b/_freeze/index/execute-results/html.json
index ad179aa..859ebc6 100644
--- a/_freeze/index/execute-results/html.json
+++ b/_freeze/index/execute-results/html.json
@@ -1,8 +1,8 @@
{
- "hash": "611f783fd0a79997277d88d14c993a76",
+ "hash": "36b1c665ceeff890e6064a36235a109c",
"result": {
"engine": "knitr",
- "markdown": "---\nformat:\n html:\n code-fold: true\n code-download: true\n code-overflow: wrap\nabout:\n template: jolla\n id: about-block\n image: \"img/my_image.png\"\n links:\n - icon: twitter\n text: Twitter\n href: https://twitter.com/MarvinSchmittML\n - icon: github\n text: Github\n href: https://github.com/marvinschmitt\n - icon: linkedin\n text: LinkedIn\n href: https://www.linkedin.com/in/marvin-schmitt-a85b321a2/\n - icon: envelope\n text: Email\n href: \"mailto:mail.marvinschmitt@gmail.com\" \n---\n\n\n::: {#about-block}\n:::\n\n# Australian honeybee colony loss survey\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Feugiat ullamcorper nullam ac donec volutpat erat amet tempus quam cubilia egestas torquent nisi mollis lacus. Sagittis urna fringilla himenaeos est nec curabitur iaculis nisl risus amet accumsan venenatis nulla. Orci accumsan hendrerit lacus litora cras placerat et ad ligula tellus platea. Viverra interdum gravida et condimentum quis placerat integer fusce.\n\nSem iaculis porttitor pellentesque libero cras porttitor tellus ac. Ligula hendrerit praesent enim felis justo eros varius consectetur molestie. Justo suspendisse habitant nunc finibus nam.\nEleifend ad lacinia curabitur taciti amet nisl sodales suspendisse orci consectetur senectus. Eleifend convallis maximus vivamus est condimentum porta est litora litora nunc fringilla maecenas non dui. Duis diam inceptos pharetra habitasse elit nibh eget scelerisque eleifend volutpat ad venenatis tempor iaculis mollis.\n\nPraesent ac integer mi eros odio etiam donec congue pellentesque scelerisque accumsan ultricies. Sodales phasellus senectus metus duis tellus ad tellus auctor congue quam litora quam euismod donec faucibus.\n\n## 2024 colony losses (not real data)\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(sf)\nlibrary(ggplot2)\nlibrary(ggiraph)\n\n# Load the shapefile\naus_shp <- st_read(\"../STE_2021_AUST_GDA2020.shx\", quiet = T)[1:8,] # remove islands\n\n# Simplify geometries with a lower tolerance and keep empty shapes\naus_shp_simplified <- st_simplify(aus_shp, dTolerance = 8000, preserveTopology = TRUE)\n\n# Ensure geometries are valid\naus_shp_simplified <- st_make_valid(aus_shp_simplified)\n\n# Remove empty geometries\naus_shp_simplified <- aus_shp_simplified[!st_is_empty(aus_shp_simplified), ]\n# Generate random numbers between 1 and 100 for each state\nset.seed(123) # For reproducibility\naus_shp_simplified$`2024 colony losses` <- sample(1:20, nrow(aus_shp_simplified), replace = TRUE)\n\n# Create ggplot object with interactive elements\np <- ggplot(aus_shp_simplified) +\n geom_sf_interactive(aes(fill = `2024 colony losses`, tooltip = `2024 colony losses`, data_id = `2024 colony losses`)) +\n scale_fill_viridis_c() +\n theme_minimal() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), axis.text = element_blank())\n\n# Render the interactive plot\ngirafe(\n ggobj = p,\n options = list(\n opts_hover(css = \"fill:orange;\"),\n opts_hover_inv(css = \"opacity:0.5;\"),\n opts_selection(type = \"single\", only_shiny = FALSE),\n opts_tooltip(css = \"font-size: 20px;\") \n )\n)\n```\n\n::: {.cell-output-display}\n\n```{=html}\n
\n\n```\n\n:::\n:::\n",
+ "markdown": "---\nformat:\n html:\n code-fold: true\n code-download: true\n code-overflow: wrap\nabout:\n template: jolla\n id: about-block\n image: \"img/my_image.png\"\n links:\n - icon: twitter\n text: Twitter\n href: https://twitter.com/MarvinSchmittML\n - icon: github\n text: Github\n href: https://github.com/marvinschmitt\n - icon: linkedin\n text: LinkedIn\n href: https://www.linkedin.com/in/marvin-schmitt-a85b321a2/\n - icon: envelope\n text: Email\n href: \"mailto:mail.marvinschmitt@gmail.com\" \nengine: knitr \n---\n\n\n::: {#about-block}\n:::\n\n# Australian honeybee colony loss survey\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Feugiat ullamcorper nullam ac donec volutpat erat amet tempus quam cubilia egestas torquent nisi mollis lacus. Sagittis urna fringilla himenaeos est nec curabitur iaculis nisl risus amet accumsan venenatis nulla. Orci accumsan hendrerit lacus litora cras placerat et ad ligula tellus platea. Viverra interdum gravida et condimentum quis placerat integer fusce.\n\n\n\n## Graphics\n\nSem iaculis porttitor pellentesque libero cras porttitor tellus ac. Ligula hendrerit praesent enim felis justo eros varius consectetur molestie. Justo suspendisse habitant nunc finibus nam.\nEleifend ad lacinia curabitur taciti amet nisl sodales suspendisse orci consectetur senectus. Eleifend convallis maximus vivamus est condimentum porta est litora litora nunc fringilla maecenas non dui. Duis diam inceptos pharetra habitasse elit nibh eget scelerisque eleifend volutpat ad venenatis tempor iaculis mollis.\n\n\n# Colony losses (not real data)\n\n\n\n::: {.cell layout-ncol=\"2\"}\n\n```{.r .cell-code}\nlibrary(sf)\nlibrary(ggplot2)\nlibrary(ggiraph)\n\n# Load the shapefile\naus_shp <- st_read(\"../STE_2021_AUST_GDA2020.shx\", quiet = T)[1:8,] # remove islands\n\n# Simplify geometries with a lower tolerance and keep empty shapes\naus_shp_simplified <- st_simplify(aus_shp, dTolerance = 8000, preserveTopology = TRUE)\n\n# Ensure geometries are valid\naus_shp_simplified <- st_make_valid(aus_shp_simplified)\n\n# Remove empty geometries\naus_shp_simplified <- aus_shp_simplified[!st_is_empty(aus_shp_simplified), ]\n# Generate random numbers between 1 and 100 for each state\nset.seed(123) # For reproducibility\naus_shp_simplified$`2024 colony losses` <- sample(1:20, nrow(aus_shp_simplified), replace = TRUE)\nyears <- 2020:2024\nstates <- c(\"New South Wales\", \"Victoria\", \"Queensland\", \"South Australia\", \"Western Australia\", \"Tasmania\", \"Northern Territory\", \"Australian Capital Territory\")\nn_states <- length(states)\ncolony_losses <- data.frame(\n state = rep(states, each = length(years)),\n year = rep(years, times = n_states),\n losses = sample(1:20, n_states * length(years), replace = TRUE)\n)\n\n\n# Create ggplot object with interactive elements\np <- ggplot(aus_shp_simplified) +\n geom_sf_interactive(aes(fill = `2024 colony losses`, tooltip = `2024 colony losses`, data_id = `2024 colony losses`)) +\n scale_fill_viridis_c() +\n theme_minimal() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), axis.text = element_blank()) + labs(title = \"2024 winter losses\") + guides(fill = guide_legend(title = NULL)) \n\n# Render the interactive plot\ngirafe(\n ggobj = p,\n options = list(\n opts_hover(css = \"fill:orange;\"),\n opts_hover_inv(css = \"opacity:0.5;\"),\n opts_selection(type = \"single\", only_shiny = FALSE),\n opts_tooltip(css = \"font-size: 20px;\") \n )\n)\n```\n\n::: {.cell-output-display}\n\n```{=html}\n\n\n```\n\n:::\n\n```{.r .cell-code}\np_line <- ggplot(colony_losses, aes(x = year, y = losses, color = state, group = state)) +\n geom_line_interactive(aes(tooltip = paste(state, year, losses, sep = \": \"), data_id = state)) +\n geom_point_interactive(aes(tooltip = paste(state, year, losses, sep = \": \"), data_id = state)) +\n theme_minimal() +\n theme(\n panel.grid.major = element_blank(),\n panel.grid.minor = element_blank(),\n axis.text = element_text(size = 12),\n axis.title = element_text(size = 14),\n legend.position = \"bottom\" \n ) +\n labs(title = \"Losses over 5 years\", x = \"Year\", y = \"Colony Losses\") + \n guides(color = guide_legend(title = NULL)) \n\ngirafe(\n ggobj = p_line,\n options = list(\n opts_hover(css = \"stroke-width:2;\"),\n opts_hover_inv(css = \"opacity:0.5;\"),\n opts_selection(type = \"single\", only_shiny = FALSE),\n opts_tooltip(css = \"font-size: 12px;\")\n )\n)\n```\n\n::: {.cell-output-display}\n\n```{=html}\n\n\n```\n\n:::\n:::\n",
"supporting": [],
"filters": [
"rmarkdown/pagebreak.lua"
diff --git a/docs/index.html b/docs/index.html
index 9e11731..43c0313 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -185,10 +185,9 @@
Australian honeybee colony loss survey
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Feugiat ullamcorper nullam ac donec volutpat erat amet tempus quam cubilia egestas torquent nisi mollis lacus. Sagittis urna fringilla himenaeos est nec curabitur iaculis nisl risus amet accumsan venenatis nulla. Orci accumsan hendrerit lacus litora cras placerat et ad ligula tellus platea. Viverra interdum gravida et condimentum quis placerat integer fusce.
+
Graphics
Sem iaculis porttitor pellentesque libero cras porttitor tellus ac. Ligula hendrerit praesent enim felis justo eros varius consectetur molestie. Justo suspendisse habitant nunc finibus nam. Eleifend ad lacinia curabitur taciti amet nisl sodales suspendisse orci consectetur senectus. Eleifend convallis maximus vivamus est condimentum porta est litora litora nunc fringilla maecenas non dui. Duis diam inceptos pharetra habitasse elit nibh eget scelerisque eleifend volutpat ad venenatis tempor iaculis mollis.
-
Praesent ac integer mi eros odio etiam donec congue pellentesque scelerisque accumsan ultricies. Sodales phasellus senectus metus duis tellus ad tellus auctor congue quam litora quam euismod donec faucibus.
-
2024 colony losses (not real data)
-
+
Colony losses (not real data)
Code
library(sf)library(ggplot2)library(ggiraph)
@@ -207,12 +206,21 @@
# Generate random numbers between 1 and 100 for each stateset.seed(123)# For reproducibilityaus_shp_simplified$`2024 colony losses`<-sample(1:20, nrow(aus_shp_simplified), replace =TRUE)
+years<-2020:2024
+states<-c("New South Wales", "Victoria", "Queensland", "South Australia", "Western Australia", "Tasmania", "Northern Territory", "Australian Capital Territory")
+n_states<-length(states)
+colony_losses<-data.frame(
+ state =rep(states, each =length(years)),
+ year =rep(years, times =n_states),
+ losses =sample(1:20, n_states*length(years), replace =TRUE)
+)
+
# Create ggplot object with interactive elementsp<-ggplot(aus_shp_simplified)+geom_sf_interactive(aes(fill =`2024 colony losses`, tooltip =`2024 colony losses`, data_id =`2024 colony losses`))+scale_fill_viridis_c()+
-theme_minimal()+theme(panel.grid.major =element_blank(), panel.grid.minor =element_blank(), axis.text =element_blank())
+theme_minimal()+theme(panel.grid.major =element_blank(), panel.grid.minor =element_blank(), axis.text =element_blank())+labs(title ="2024 winter losses")+guides(fill =guide_legend(title =NULL))# Render the interactive plotgirafe(
@@ -223,16 +231,46 @@
opts_selection(type ="single", only_shiny =FALSE),opts_tooltip(css ="font-size: 20px;"))
+)
+p_line<-ggplot(colony_losses, aes(x =year, y =losses, color =state, group =state))+
+geom_line_interactive(aes(tooltip =paste(state, year, losses, sep =": "), data_id =state))+
+geom_point_interactive(aes(tooltip =paste(state, year, losses, sep =": "), data_id =state))+
+theme_minimal()+
+theme(
+ panel.grid.major =element_blank(),
+ panel.grid.minor =element_blank(),
+ axis.text =element_text(size =12),
+ axis.title =element_text(size =14),
+ legend.position ="bottom"
+)+
+labs(title ="Losses over 5 years", x ="Year", y ="Colony Losses")+
+guides(color =guide_legend(title =NULL))
+
+girafe(
+ ggobj =p_line,
+ options =list(
+opts_hover(css ="stroke-width:2;"),
+opts_hover_inv(css ="opacity:0.5;"),
+opts_selection(type ="single", only_shiny =FALSE),
+opts_tooltip(css ="font-size: 12px;")
+))