Plot Sunshine Hours

Description

Plot the duration of accumulated bright sunshine hours through time.

Usage

1
2
3
4
## S4 method for signature 'cfSunshine,missing'
plot(x, y, ggtheme = c("grey", "gray", "bw",
  "linedraw", "light", "minimal", "classic"), scales = c("fixed", "free_x",
  "free_y", "free"), n_col = 1, ...)

Arguments

x

a cfSunshine object.

y

missing.

ggtheme

character string (partially) matching the ggtheme to be used for plotting, see 'Theme Selection' below.

scales

character string partially matching the scales argument in the link[ggplot2]{facet_wrap} function.

n_col

the number of columns of plots (default 1).

...

further arguments passed to theme.

See Also

plot,cfDataList,missing-method for general information on default plotting of cfData and cfDataList objects, and the links within. See cf_query for creating cfSunshine objects.

Refer to theme for more possible arguments to pass to these methods.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## Not run: 
# Retrieve public hourly sunshine data for the last 7 days 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_sun = cf_query(cf_user(), cf_datatype(5, 1, 2), cf_station(),
                       start_date = last_week)

class(reefton_sun) # cfSunshine object

# Plot the temperature data using the defaults
plot(reefton_sun)

# Enlarge the text and add the observations as points
library(ggplot2) # for element_text() and geom_point()
plot(reefton_sun, 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_sunshine_plot.png")

## End(Not run)