# install the packages if necessary
if (!require("tidyverse")) install.packages("tidyverse")
if (!require("fs")) install.packages("fs")
if (!require("geomtextpath")) install.packages("geomtextpath")
# packages
library(tidyverse)
library(fs)
library(janitor)
library(geomtextpath)
Feed: Dr Dominic Royé
Entries found: 20
A data-driven normal for the Spain temperature chart
Published: Mon, 22 Jun 2026 22:00:00 GMT
Updated: Mon, 22 Jun 2026 22:00:00 GMT
UTC: 2026-06-22 22:00:00+00:00
URL: https://dominicroye.github.io/blog/spain-temperature-normals-openmeteo/
Map projections: a practical guide to common mistakes and how to fix them
Published: Sat, 02 May 2026 22:00:00 GMT
Updated: Sat, 02 May 2026 22:00:00 GMT
UTC: 2026-05-02 22:00:00+00:00
URL: https://dominicroye.github.io/blog/map-projections/
Downscaling solar radiation in the Canary Islands with GAM
Published: Sun, 01 Mar 2026 23:00:00 GMT
Updated: Sun, 01 Mar 2026 23:00:00 GMT
UTC: 2026-03-01 23:00:00+00:00
URL: https://dominicroye.github.io/blog/canary-gam-downscaling/
Mapping building use with a hexagonal grid
Published: Sat, 31 Jan 2026 23:00:00 GMT
Updated: Sat, 31 Jan 2026 23:00:00 GMT
UTC: 2026-01-31 23:00:00+00:00
URL: https://dominicroye.github.io/blog/hex-map-buuse/
Broken Chart: discover 9 visualization alternatives
Published: Sat, 13 Dec 2025 23:00:00 GMT
Updated: Sat, 13 Dec 2025 23:00:00 GMT
UTC: 2025-12-13 23:00:00+00:00
URL: https://dominicroye.github.io/blog/broken-charts/
Always normalize your data
Published: Sat, 04 Jan 2025 23:00:00 GMT
Updated: Sat, 04 Jan 2025 23:00:00 GMT
UTC: 2025-01-04 23:00:00+00:00
URL: https://dominicroye.github.io/blog/always-normalize-your-data/
Map of circles grouped in multiple locations
Published: Fri, 19 Apr 2024 22:00:00 GMT
Updated: Fri, 19 Apr 2024 22:00:00 GMT
UTC: 2024-04-19 22:00:00+00:00
URL: https://dominicroye.github.io/blog/map-circle-packing/
Inserted maps with ggplot2
Published: Sat, 07 Oct 2023 22:00:00 GMT
Updated: Sat, 07 Oct 2023 22:00:00 GMT
UTC: 2023-10-07 22:00:00+00:00
URL: https://dominicroye.github.io/blog/inserted-map/
Tomorrow’s weather
Published: Sun, 19 Feb 2023 23:00:00 GMT
Updated: Sun, 19 Feb 2023 23:00:00 GMT
UTC: 2023-02-19 23:00:00+00:00
URL: https://dominicroye.github.io/blog/tomorrows-weather/
Hillshade effects
Published: Tue, 19 Jul 2022 22:00:00 GMT
Updated: Tue, 19 Jul 2022 22:00:00 GMT
UTC: 2022-07-19 22:00:00+00:00
URL: https://dominicroye.github.io/blog/hillshade-effect/
Use of multidimensional spatial data
Published: Mon, 07 Mar 2022 23:00:00 GMT
Updated: Mon, 07 Mar 2022 23:00:00 GMT
UTC: 2022-03-07 23:00:00+00:00
URL: https://dominicroye.github.io/blog/use-multidimensional-spatial-data/
Visualize the day-night cycle on a world map
Published: Sun, 19 Dec 2021 23:00:00 GMT
Updated: Sun, 19 Dec 2021 23:00:00 GMT
UTC: 2021-12-19 23:00:00+00:00
URL: https://dominicroye.github.io/blog/night-day-world/
Climate circles
Published: Fri, 03 Sep 2021 22:00:00 GMT
Updated: Fri, 03 Sep 2021 22:00:00 GMT
UTC: 2021-09-03 22:00:00+00:00
URL: https://dominicroye.github.io/blog/climate-circles/The climate of a place is usually presented through climographs that combine monthly precipitation and temperature in a single chart. However, it is also interesting to visualize the climate on a daily scale showing the thermal amplitude and the daily average temperature. To do this, the averages for each day of the year of daily minimums, maximums and means are calculated.Content Preview
The climate of a place is usually presented through climographs that combine monthly precipitation and temperature in a single chart. However, it is also interesting to visualize the climate on a daily scale showing the thermal amplitude and the daily average temperature. To do this, the averages for each day of the year of daily minimums, maximums and means are calculated.
The annual climate cycle presents a good opportunity to use a radial or polar chart which allows us to clearly visualize seasonal patterns.
Packages
We will use the following packages:
Package Description tidyverse Collection of packages (visualization, manipulation): ggplot2, dplyr, purrr, etc. fs Provides a cross-platform, uniform interface to file system operations geomtextpath ggplot2 extension for curved text on lines janitor Simple functions to examine and clean data Preparation
Data
We download the temperature data for a selection of US cities here . You can access other cities of the entire world through the WMO or GHCN datasets at NCDC/NOAA .
source("terminator.R") # import the functionsImport
To import the temperature time series of each city, which we find in several files, we apply the read_csv() function using
map(). Thedir_ls()function of the fs package returns the list of files with csv extension. Thelist_rbind()function join all imported tables into a single one.Then we obtain the names of the weather stations and define a new vector with the new city names.
# import data meteo <- dir_ls(regexp = ".csv$") |> map(read_csv) |> list_rbind() meteo # station names stats_names <- unique(meteo$NAME) stats_names # new city names cities <- c( "CHICAGO", "NEW YORK", "MIAMI", "HOUSTON", "ATLANTA", "SAN FRANCISCO", "SEATTLE", "DENVER", "LAS VEGAS" )Preparation
In the first step, we will modify the original data, 1) selecting only the columns of interest, 2) filtering the period 1991-2020, 3) defining the new city names, 4) calculating the average temperature where it is absent, 5) cleaning the column names, and 6) creating a new variable with the days of the year. The
clean_names()function of thejanitorpackage is very useful for getting clean column names.meteo <- select(meteo, NAME, DATE, TAVG:TMIN) |> filter(DATE >= "1991-01-01", DATE <= "2020-12-31") |> mutate( NAME = factor(NAME, stats_names, cities), TAVG = ifelse(is.na(TAVG), (TMAX + TMIN) / 2, TAVG), yd = yday(DATE) ) |> clean_names()In the next step, we calculate the daily maximum, minimum and mean temperature for each day of the year. It now only remains to convert the days of the year into a dummy date. Here we use the year 2000 since it is a leap year, and we have a total of 366 days.
# estimate the daily averages meteo_yday <- group_by(meteo, name, yd) |> summarise( ta = mean(tavg, na.rm = TRUE), tmx = mean(tmax, na.rm = TRUE), tmin = mean(tmin, na.rm = TRUE) ) meteo_yday # convert the days of the year into a dummy date meteo_yday <- mutate(meteo_yday, yd = as_date(yd, origin = "1999-12-31"))Back to top Creating the climate circles
Predefinitions
We define a divergent vector of various hues.
col_temp <- c( "#cbebf6", "#a7bfd9", "#8c99bc", "#974ea8", "#830f74", "#0b144f", "#0e2680", "#223b97", "#1c499a", "#2859a5", "#1b6aa3", "#1d9bc4", "#1ca4bc", "#64c6c7", "#86cabb", "#91e0a7", "#c7eebf", "#ebf8da", "#f6fdd1", "#fdeca7", "#f8da77", "#fcb34d", "#fc8c44", "#f85127", "#f52f26", "#d10b26", "#9c042a", "#760324", "#18000c" )We create a table with the x-axis grid lines.
grid_x <- tibble( x = seq(ymd("2000-01-01"), ymd("2000-12-31"), "month"), y = rep(-10, 12), xend = seq(ymd("2000-01-01"), ymd("2000-12-31"), "month"), yend = rep(41, 12) )We define all the style elements of the graph in our own theme
theme_cc().theme_cc <- function() { theme_void(base_family = "Montserrat") %+replace% theme( plot.title = element_text(hjust = 0.5, colour = "white", size = 30, margin = margin(b = 20)), plot.caption = element_text(colour = "white", size = 9, hjust = .5, vjust = -30), plot.background = element_rect(fill = "black"), plot.margin = margin(1, 1, 2, 1, unit = "cm"), axis.text.x = element_text(face = "italic", colour = "white", margin = margin()), axis.title.y = element_blank(), axis.text.y = element_blank(), legend.title = element_text(colour = "white"), legend.position = "bottom", legend.justification = 0.5, legend.text = element_text(colour = "white"), strip.text = element_text(colour = "white", face = "bold", size = 14), panel.spacing.y = unit(1, "lines"), panel.background = element_rect(fill = "black"), panel.grid = element_blank() ) }Graph
We start by building a chart for New York City only. We will use
geom_linerange()to define line range with the daily maximum and minimum temperature. Also, we will draw the range line colour based on the mean temperature. Finally, we can adjust alpha and size to get a nicer look.# filter New York ny_city <- filter(meteo_yday, name == "NEW YORK") # graph ggplot(ny_city) + geom_linerange( aes(yd, ymax = tmx, ymin = tmin, colour = ta ), size = 0.5, alpha = .7 ) + scale_y_continuous( breaks = seq(-30, 50, 10), limits = c(-11, 42), expand = expansion() ) + scale_colour_gradientn( colours = col_temp, limits = c(-12, 35), breaks = seq(-12, 34, 5) ) + scale_x_date( date_breaks = "month", date_labels = "%b" ) + labs( title = "CLIMATE CIRCLES", colour = "Daily average temperature" )To get the polar graph it would only be necessary to add the
coord_radial()function.# polar chart ggplot(ny_city) + geom_linerange( aes(yd, ymax = tmx, ymin = tmin, colour = ta ), size = 0.5, alpha = .7 ) + scale_y_continuous( breaks = seq(-30, 50, 10), limits = c(-11, 42), expand = expansion() ) + scale_colour_gradientn( colours = col_temp, limits = c(-12, 35), breaks = seq(-12, 34, 5) ) + scale_x_date( date_breaks = "month", date_labels = "%b" ) + coord_radial(expand = F) + labs( title = "CLIMATE CIRCLES", colour = "Daily average temperature" )
![]()
![]()
In the final graph, we add the grid defining the lines on the y-axis with
geom_hline()and those on the x-axis withgeom_segement(). The most important thing here is thefacet_wrap()function, which allows multiple facets of charts. The formula format is used to specify how the facets are created:row ~ column. If we do not have a second variable, a point . is indicated in the formula. In addition, we make changes to the appearance of the colour bar withguides()and guide_colourbar(), and we include thetheme_cc()style.ggplot(meteo_yday) + geom_texthline( data = tibble(y = c(-10, 0, 10, 20, 30, 40)), aes(yintercept = y, label = y), colour = "white", linewidth = .4, size = 2 ) + geom_segment( data = grid_x, aes( x = x, y = y, xend = xend, yend = yend ), linetype = "dashed", colour = "white", linewidth = .2 ) + geom_linerange( aes(yd, ymax = tmx, ymin = tmin, colour = ta ), linewidth = 0.5, alpha = .7 ) + scale_y_continuous( breaks = seq(-30, 50, 10), limits = c(-15, 41.5), expand = expansion() ) + scale_colour_gradientn( colours = col_temp, limits = c(-12, 35), breaks = seq(-12, 34, 5) ) + scale_x_date( date_breaks = "month", date_labels = "%b" ) + guides(colour = guide_colourbar( barwidth = 15, barheight = 0.5, title.position = "top" ), theta = "axis_textpath") + 1 facet_wrap(~name, nrow = 3) + coord_radial(r.axis.inside = T, expand = F) + labs( title = "CLIMATE CIRCLES", colour = "Daily average temperature" ) + theme_cc()
- 1
- For curved text on theta (x axis in polar coordinate systems)
Reuse
Citation
For attribution, please cite this work as:Royé, Dominic. 2021. “Climate Circles.” September 4. https://dominicroye.github.io/blog/climate-circles/ .
Firefly cartography
Published: Mon, 31 May 2021 22:00:00 GMT
Updated: Mon, 31 May 2021 22:00:00 GMT
UTC: 2021-05-31 22:00:00+00:00
URL: https://dominicroye.github.io/blog/firefly-maps/
Bivariate dasymetric map
Published: Sun, 28 Feb 2021 23:00:00 GMT
Updated: Sun, 28 Feb 2021 23:00:00 GMT
UTC: 2021-02-28 23:00:00+00:00
URL: https://dominicroye.github.io/blog/bivariate-dasymetric-map/
A heatmap as calendar
Published: Sat, 19 Dec 2020 23:00:00 GMT
Updated: Sat, 19 Dec 2020 23:00:00 GMT
UTC: 2020-12-19 23:00:00+00:00
URL: https://dominicroye.github.io/blog/calendar-heatmap/
Climate animation of maximum temperatures
Published: Sat, 10 Oct 2020 22:00:00 GMT
Updated: Sat, 10 Oct 2020 22:00:00 GMT
UTC: 2020-10-10 22:00:00+00:00
URL: https://dominicroye.github.io/blog/climate-animation-maximum-temperature/
River flow directions
Published: Thu, 23 Jul 2020 22:00:00 GMT
Updated: Thu, 23 Jul 2020 22:00:00 GMT
UTC: 2020-07-23 22:00:00+00:00
URL: https://dominicroye.github.io/blog/river-flow-directions/
Visualize climate anomalies
Published: Sat, 28 Mar 2020 23:00:00 GMT
Updated: Sat, 28 Mar 2020 23:00:00 GMT
UTC: 2020-03-28 23:00:00+00:00
URL: https://dominicroye.github.io/blog/climate-anomalies/
Geographic distance
Published: Sat, 18 Jan 2020 23:00:00 GMT
Updated: Sat, 18 Jan 2020 23:00:00 GMT
UTC: 2020-01-18 23:00:00+00:00
URL: https://dominicroye.github.io/blog/geographic-distance/
The climate of a place is usually presented through climographs that combine monthly precipitation and temperature in a single chart. However, it is also interesting to visualize the climate on a daily scale showing the thermal amplitude and the daily average temperature. To do this, the averages for each day of the year of daily minimums, maximums and means are calculated.