Learn R Programming

bReeze (version 0.3-2)

plotUncertainty: Plot uncertainties and probability of exceedance

Description

Plots uncertainties or probability of exceedance from an uncertainty object.

Usage

plotUncertainty(uncertainty, type=c("prob", "uncert"), 
  p.values=c(50, 75, 90), ...)
pluc(uncertainty, type=c("prob", "uncert"), 
  p.values=c(50, 75, 90), ...)

Arguments

uncertainty
Uncertainty object created by uncertainty.
type
Type of plot as string. One of "prob" (probability of exceedance plot) or "uncert" (uncertainties overview plot).
p.values
The P-values highlighted in the plot as numeric vector -- default is P50, P75 and P90.
...
Optional graphical parameters, see below for details.

encoding

UTF-8

Optional graphical parameters

The following graphical parameters can optionally be added to customize the probability of exceedance plot (type="prob"):
  • 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 is1), 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 n colours -- [1] for the probability curve, [2:n] for the highlighted P-values (p.values).
  • 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 (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 of0(always parallel to the axis, default),1(always horizontal),2(always perpendicular to the axis),3(always vertical).
  • legend: IfTRUE(the default) a legend is drawn.
  • leg.text: Vector of strings used as alternative legend text.
  • lty: Vector of line types -- usage likecol. Seeparfor available line types.
  • lwd: Vector of line widths -- usage likecol. Seeparfor 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 isc(4.5, 4.5, 1, 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 isc(2.7, 0.7, 0).
  • pos.leg: Position of legend -- one of"bottomright","bottom","bottomleft","left","topleft","top","topright","right"or"center".
  • xlab: Alternative label for the x axis.
  • ylab: Alternative label for the y axis.
  • xlim: Limits of the x axis, as vector of two values.
  • ylim: Limits of the y axis, as vector of two values.
  • x.intersp: Horizontal interspacing factor for legend text, as numeric -- default is0.4.
  • y.intersp: Vertical line distance for legend text, as numeric -- default is0.8. Optional graphical parameters for the uncertainty overview plot (type="uncert"):
  • border: Colour to be used for the border of the bars -- usage likecol, as default no border is drawn.
  • cex: Amount by which text on the plot should be scaled relative to the default (which is1), as numeric. To be used for scaling of all texts at once.
  • cex.axis: Amount by which the names of the uncertainty components should be scaled, as numeric value.
  • cex.text: Amount by which the uncertainty values inside the bars should be scaled, as numeric value.
  • col: One or a vector of colours. If one colour is specified, this colour is used for all bars. If two colours are specified, the first colour is used for uncertainty component bars and the second for the total uncertainty bar. Separate colours for each bar can also be specified.
  • col.axis: Colour to be used for the names of the uncertainty components -- default is"black".
  • col.text: Colour to be used for the uncertainty values inside the bars -- default is"white".
  • 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.
  • 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 isc(3, 1, 0).
  • space: Numeric value between 0 and 1, giving the space left before each bar. Default space is0.2.

See Also

uncertainty

Examples

Run this code
# load and prepare data
data(winddata)
set1 <- createSet(height=40, v.avg=winddata[,2], dir.avg=winddata[,14])
set2 <- createSet(height=30, v.avg=winddata[,6], dir.avg=winddata[,16])
ts <- formatTS(time.stamp=winddata[,1])
neubuerg <- createMast(time.stamp=ts, set1, set2)
neubuerg <- clean(mast=neubuerg)
nb.wp <- profile(mast=neubuerg, v.set=c(1, 2), dir.set=1, 
  print=FALSE)
pw.56 <- readPC(file="PowerWind_56_900kW.wtg")
nb.aep <- aep(profile=nb.wp, pc=pw.56, hub.h=71, print=FALSE)

# calculate uncertainty
nb.uc <- uncertainty(nb.aep, uc.values=c(5, 10, 5, 5), 
  uc.names=c("wind measurement", "long term data", 
  "flow model", "power curve"))

# probability of exceedance plot
plotUncertainty(uncertainty=nb.uc)

# change highlighted P-values
plotUncertainty(uncertainty=nb.uc, p.values=c(50, 95))

# change colours, line types, line width and text size
plotUncertainty(uncertainty=nb.uc, col="blue", lty=c(1, 2, 3, 4), 
  lwd=2, cex=1.2)

# freaky
plotUncertainty(uncertainty=nb.uc, bty="l", bty.leg="o", cex.axis=2, 
  cex.lab=0.5, cex.leg=0.8, col=c(5, 10, 15, 20), col.axis="sienna", 
  col.box="purple", col.lab="plum", col.leg="orchid", col.ticks="gold", 
  las=0, lty=c(8, 7, 6, 5), lwd=c(5, 3, 1, 0.5), mar=c(6, 5, 4, 3), 
  mgp=c(4, 2, 1), pos.leg="bottomleft", xlim=c(0.1, 0.9), ylim=c(1000, 2000), 
  x.intersp=2, y.intersp=1.5)


# uncertainty overview plot
plotUncertainty(uncertainty=nb.uc, type="uncert")

# change colours and border
plotUncertainty(uncertainty=nb.uc, type="uncert", 
  col="red", border="red4")
plotUncertainty(uncertainty=nb.uc, type="uncert", 
  col=c(gray(0.7), gray(0.5)), border=c(gray(0.6), gray(0.4)))
plotUncertainty(uncertainty=nb.uc, type="uncert", 
  col=c(5:1), border=c(1:5))

# change text size, space and margin
plotUncertainty(uncertainty=nb.uc, type="uncert", 
  cex=1.5, space=0.1, mar=c(1, 13, 1, 1))

# freaky
plotUncertainty(uncertainty=nb.uc, type="uncert", 
  border=c(11, 22, 33, 44, 55), cex.axis=0.7, cex.text=2, 
  col=c("maroon", "navy", "thistle", "rosybrown", "papayawhip"), 
  col.axis="pink3", col.text="seagreen", mar=c(3, 8, 2, 1), 
  mgp=c(0, 1, 2), space=1)

Run the code above in your browser using DataLab