From 6263f45370513df8de394bab82ef4e0fb305f0b5 Mon Sep 17 00:00:00 2001 From: Frederik Vanrenterghem Date: Tue, 18 Mar 2025 22:58:08 +0800 Subject: [PATCH] Update color scheme for org exports to fix R code blocks. Issue: R code blocks not htmlized. * Use output from org-html-htmlize-generate-css as basis. * Add background color manually. * Re-process recent posts with R code to verify. --- source/assets/styles/org-htmlize.css | 5869 +++++++++++++++++- source/posts/Red_Rooster_line.org | 14 +- source/posts/explore-AU-road-fatalities.org | 4 + source/posts/obtaining_SLIP_data_using_R.org | 10 +- 4 files changed, 5841 insertions(+), 56 deletions(-) diff --git a/source/assets/styles/org-htmlize.css b/source/assets/styles/org-htmlize.css index 2884c65..12d8bf1 100644 --- a/source/assets/styles/org-htmlize.css +++ b/source/assets/styles/org-htmlize.css @@ -1,53 +1,5824 @@ diff --git a/source/posts/Red_Rooster_line.org b/source/posts/Red_Rooster_line.org index 7e733b6..712bbca 100644 --- a/source/posts/Red_Rooster_line.org +++ b/source/posts/Red_Rooster_line.org @@ -4,7 +4,12 @@ #+BEGIN_PREVIEW -Listening to ABC Radio National a couple of weeks ago, I learned about Sydney's Red Rooster line. It's a straight line that can be drawn across Sydney marking the socio-economic divide that exists between the northern and eastern suburbs of Sydney and the western and soutwestern ones. Out of curiosity, I set out to explore this using data available on the open web, in particular [[https://welcome.openstreetmap.org/what-is-openstreetmap/][OpenStreetMap]]. +Listening to ABC Radio National a couple of weeks ago, I learned about +Sydney's Red Rooster line. It's a straight line that can be drawn +across Sydney marking the socio-economic divide that exists between +the northern and eastern suburbs of Sydney and the western and +soutwestern ones. Out of curiosity, I set out to explore this using +data available on the open web, in particular [[https://welcome.openstreetmap.org/what-is-openstreetmap/][OpenStreetMap]]. #+ATTR_HTML: :class img-fluid :alt Map of Sydney with Red Rooster line [[file:../assets/Sydney_Red_Rooster_line.png]] @@ -13,7 +18,12 @@ The above map was drawn in R using [[https://www.openstreetmap.org/][OpenStreetM #+END_PREVIEW -In R, obtaining data from OpenStreetMap is most easily done using the ~osmdata~ library, which provides functions to create and send an Overpass query. For instance, the snippet below obtains all locations that have been tagged as a fast food amenity within a geographical bounding box. In the same way, all roads, waterways and suburb boundaries can be obtained. +In R, obtaining data from OpenStreetMap is most easily done using the +~osmdata~ library, which provides functions to create and send an +Overpass query. For instance, the snippet below obtains all locations +that have been tagged as a fast food amenity within a geographical +bounding box. In the same way, all roads, waterways and suburb +boundaries can be obtained. #+BEGIN_SRC R fastfood <- lapply(bb, function(x) { diff --git a/source/posts/explore-AU-road-fatalities.org b/source/posts/explore-AU-road-fatalities.org index 6c60f33..f78fef4 100644 --- a/source/posts/explore-AU-road-fatalities.org +++ b/source/posts/explore-AU-road-fatalities.org @@ -12,6 +12,7 @@ great example of how governments are moving with the times! :PROPERTIES: :CUSTOM_ID: trends :HTML_CONTAINER_CLASS: card-body +:ID: de00a72a-62e9-4734-9761-5f1dc2183d35 :END: I started by looking at the trends - what is the approximate number of road fatalities a year, and how is it evolving over time? Are there any @@ -31,6 +32,7 @@ differences noticeable between states? Or by gender? :PROPERTIES: :CUSTOM_ID: what-age-group-is-most-at-risk-in-city-traffic :HTML_CONTAINER_CLASS: card-body +:ID: d8ffd326-b99b-4600-81f7-2a19568b5076 :END: Next, I wondered if there were any particular ages that were more at risk in city traffic. I opted to quickly bin the data to produce a @@ -56,6 +58,7 @@ fatalities %>% :PROPERTIES: :CUSTOM_ID: hypothesis :HTML_CONTAINER_CLASS: card-body +:ID: d738f312-084f-4a56-ada7-0a41352fff9c :END: Based on the above, I wondered - are people above 65 more likely to die in slow traffic areas? To make this a bit easier, I added two variables @@ -130,6 +133,7 @@ prop.test(pensioners,everyone) :PROPERTIES: :CUSTOM_ID: conclusion :HTML_CONTAINER_CLASS: card-body +:ID: ae6f0786-f9ae-4d76-baf6-58a06503d051 :END: It's possible to conclude older people are over-represented in the fatalities in lower speed zones. Further ideas for investigation are diff --git a/source/posts/obtaining_SLIP_data_using_R.org b/source/posts/obtaining_SLIP_data_using_R.org index 7da1c96..03c43d6 100644 --- a/source/posts/obtaining_SLIP_data_using_R.org +++ b/source/posts/obtaining_SLIP_data_using_R.org @@ -2,11 +2,11 @@ #+filetags: :R:spatial:analysis:visualisation: #+title: Obtaining WA Landgate Shared Location Information using R. -Six years ago, [[file:using spatial features and openstreetmap][I wrote about Simple Features (sf) in R]]. I mapped the number of pupils per high -school in the Perth metro area. At the time, I didn't include how to -obtain the shapefile, provided as open data by Landgate on behalf of the -Western Australian government through its Shared Location Information -Platform ([[https://data.wa.gov.au/slip][SLIP]]). +Six years ago, [[file:using spatial features and openstreetmap][I wrote about Simple Features (sf) in R]]. I mapped the +number of pupils per high school in the Perth metro area. At the time, +I didn't include how to obtain the shapefile, provided as open data by +Landgate on behalf of the Western Australian government through its +Shared Location Information Platform ([[https://data.wa.gov.au/slip][SLIP]]). I have now updated the script, [[http://git.vanrenterghem.biz/?p=R/project-wa-schools.git;a=summary][available in my code repository]], with an R implementation of -- 2.39.5