# NOT RUN {
# Retrieve public temperature data from screen observations for the last week
# at Reefton Ews station
# Subtract 7 days from today's date to get the start date
last_week = paste(as.character(Sys.Date() - 7), 0)
reefton_screenobs = cf_query(cf_user(), cf_datatype(4, 1, 1), cf_station(),
start_date = last_week)
class(reefton_screenobs) # cfScreenObs object
# Plot the temperature data using the defaults
plot(reefton_screenobs)
# Enlarge the text and add the observations as points
library(ggplot2) # for element_text() and geom_point()
plot(reefton_screenobs, ggtheme = "bw", text = element_text(size = 16)) +
geom_point(size = 3, shape = 1)
# Save the plot as a png to the current working directory
library(ggplot2) # for ggsave()
ggsave("my_screenobs_plot.png")
# }
Run the code above in your browser using DataLab