I'm making a plot of air quality in Delta Junction, Alaska and am trying to add a title to my figure that says "Delta Junction Air Quality Index" but the Delta part of the title gets converted to the delta symbol and I can't figure out how to keep it from doing that.
I'm using the openair
package to create this plot. My example code below also uses lubridate
to create a date column of the airquality
built in dataset.
I first tried just using main = "Delta Junction Air Quality Index"
library(lubridate)
library(openair)
test <- as.data.frame(airquality)
test$date <- NA
test$date <- paste(test$Month,"-",test$Day,"- 2024")
test$date <- mdy(test$date)
calendarPlot(test,
pollutant = "Ozone",
month = 5,
statistic = "mean",
annotate = "value",
main = "Delta Junction Air Quality Index")
This is what the resulting plot looked like:
I also tried specifying a title as its own object, to no avail.
title <- "Delta Junction Air Quality Index"
test <- as.data.frame(airquality)
test$date <- NA
test$date <- paste(test$Month,"-",test$Day,"- 2024")
test$date <- mdy(test$date)
calendarPlot(test,
pollutant = "Ozone",
month = 5,
statistic = "mean",
annotate = "value",
main = title)
I then tried the below code which did keep Delta spelled out but added asterisks * around the word:
test <- as.data.frame(airquality)
test$date <- NA
test$date <- paste(test$Month,"-",test$Day,"- 2024")
test$date <- mdy(test$date)
calendarPlot(test,
pollutant = "Ozone",
month = 5,
statistic = "mean",
annotate = "value",
main = "'Delta' Junction Air Quality Index")
Use auto.text= FALSE
: from ?calendarPlot
,
auto.text
: Either ‘TRUE’ (default) or ‘FALSE’. If ‘TRUE’ titles and axis labels will automatically try and format pollutant names and units properly e.g. by subscripting the `2' in NO2.
(It would be harder if you want to protect "Delta" from translation and convert subscripts etc. automatically ... you could probably provide the title as an expression as in ?plotmath
...)