Learn R Programming

bReeze (version 0.4-4)

day.plot: Plot diurnal wind speed

Description

Plots the diurnal variation of wind speed or wind direction.

Usage

day.plot(mast, set, dir.set=set, signal, num.sectors=NULL, subset, ...)
day(mast, set, dir.set=set, signal, num.sectors=NULL, subset, ...)

Arguments

mast

Met mast object created by mast.

set

Set used for plotting, specified as set number or set name. Argument is optional -- if missing, all sets containing the choosen signal are used.

dir.set

Direction set used for sectoral splitting of the data, specified as set number or set name. Argument is used for sectoral plotting only (see num.sectors).

signal

Signal to be plotted as string.

num.sectors

Number of wind direction sectors as integer value greater 1. Argument is optional -- if not NULL, data is splitted into directional sectors for plotting. Sectoral plots are available only for single sets.

subset

Optional start and end time stamp for a data subset, as string vector c(start, end). The time stamps format shall follow the rules of ISO 8601 international standard, e.g. "2012-08-08 22:55:00".

...

Optional graphical parameters, see below for details.

Optional graphical parameters

The following graphical parameters can optionally be added to customize the plot:

  • bty: Type of box to be drawn around the plot region. Allowed values are "o" (the default), "l", "7", "c", "u", or "]". The resulting box resembles the corresponding upper case letter. A value of "n" suppresses the box.

  • bty.leg: Type of box to be drawn around the legend. Allowed values are "n" (no box, the default) and "o".

  • cex: Amount by which text on the plot should be scaled relative to the default (which is 1), as numeric. To be used for scaling of all texts at once.

  • cex.axis: Amount by which axis annotations should be scaled, as numeric value.

  • cex.lab: Amount by which axis labels should be scaled, as numeric value.

  • cex.leg: Amount by which legend text should be scaled, as numeric value.

  • col: Vector of colours, one for each set plotted.

  • col.axis: Colour to be used for axis annotations -- default is "black".

  • col.box: Colour to be used for the box around the plot region (if bty) -- default is "black".

  • col.lab: Colour to be used for axis labels -- default is "black".

  • col.leg: Colour to be used for legend text -- default is "black".

  • col.ticks: Colours for the axis line and the tick marks respectively -- default is "black".

  • las: Style of axis labels. One of 0 (always parallel to the axis, default), 1 (always horizontal), 2 (always perpendicular to the axis), 3 (always vertical).

  • lty: Vector of line types, one for each set plotted. See par for available line types.

  • lwd: Vector of line widths, one for each set plotted. See par for usage.

  • mar: A numerical vector of the form c(bottom, left, top, right) which gives the number of lines of margin to be specified on the four sides of the plot -- default is c(4.5, 5, 1.5, 1).

  • mgp: A numerical vector of the form c(label, annotation, line), which gives the margin line for the axis label, axis annotation and axis line. The default is c(2, 0.7, 0).

  • pos.leg: Position of legend -- one of "bottomright", "bottom", "bottomleft", "left", "topleft", "top", "topright", "right" or "center". Use NULL to hide the legend.

  • xlab: Alternative label for the x axis.

  • ylab: Alternative label for the y axis.

  • ylim: Limits of the y axis, as vector of two values.

  • x.intersp: Horizontal interspacing factor for legend text, as numeric -- default is 0.4.

  • y.intersp: Vertical line distance for legend text, as numeric -- default is 0.8.

Author

Christian Graul

Details

plotDay reveals diurnal variations of a signal. The plot may show outliers that indicate data inconsistancy.

See Also

mast

Examples

Run this code
if (FALSE) {
# load and prepare data
data("winddata", package="bReeze")
set40 <- set(height=40, v.avg=winddata[,2], dir.avg=winddata[,14])
set30 <- set(height=30, v.avg=winddata[,6], dir.avg=winddata[,16])
set20 <- set(height=20, v.avg=winddata[,10])
ts <- timestamp(timestamp=winddata[,1])
neubuerg <- mast(timestamp=ts, set40, set30, set20)
neubuerg <- clean(mast=neubuerg)

# plot all datasets
day.plot(mast=neubuerg, signal="v.avg")
day.plot(mast=neubuerg, signal="dir.avg")

# plot one dataset
day.plot(mast=neubuerg, set=1, signal="v.avg")
day.plot(mast=neubuerg, set="set1", signal="v.avg")	# same as above
day.plot(mast=neubuerg, set=2, signal="dir.avg")

# sectoral plot
day.plot(mast=neubuerg, set=1, signal="v.avg", num.sectors=8)

# data subsets
day.plot(mast=neubuerg, signal="v.avg", 
  subset=c("2009-12-01 00:00:00", "2009-12-31 23:50:00"))
day.plot(mast=neubuerg, signal="v.avg",  
  subset=c("2010-01-01 00:00:00", NA)) # just 'start' time stamp
day.plot(mast=neubuerg, set=1, signal="v.avg", num.sectors=4, 
  subset=c(NA, "2009-12-31 23:50:00")) # just 'end' time stamp

# customize plot
day.plot(mast=neubuerg, signal="v.avg", 
  bty="l", cex.axis=0.8, cex.lab=0.9, cex.leg=0.7, 
  col=c("darkgreen", "royalblue", "purple"), col.axis="darkgray", 
  col.box="darkgray", col.lab="darkgray", col.leg="darkgray", 
  col.ticks="darkgray", las=2, lty=c(2,3,4), lwd=1.5, mar=c(3, 3, 0.5, 0.5), 
  mgp=c(1.5, 0.5, 0), pos.leg="topleft", xlab="hour", ylab="velocity", 
  ylim=c(3.5,6), x.intersp=1, y.intersp=1)
}

Run the code above in your browser using DataLab