Learn R Programming

bReeze (version 0.3-2)

plotWeibull: Plot wind speed distribution and Weibull fit

Description

Plots the distribution of wind speeds and the fitted weibull distribution from a weibull object.

Usage

plotWeibull(wb, show.ak=FALSE, ...)
plwb(wb, show.ak=FALSE, ...)

Arguments

wb
Weibull object created by weibull.
show.ak
If TRUE, the Weibull parameters A and k are added to the legend.
...
Optional graphical parameters, see below for details.

encoding

UTF-8

Optional graphical parameters

The following graphical parameters can optionally be added to customize the plot:
  • border: Colour, used for the border around the bars -- default is"white".
  • breaks: A numeric vector giving the breakpoints between histogram cells.
  • 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: Colour, used to fill the bars.
  • 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 (ifbty) -- 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: A character orexpressionvector to appear in the legend.
  • line: Colour, used for the Weibull fit line.
  • lty: Line type of the Weibull fit line -- seeparfor available line types.
  • lwd: Line width for the Weibull fit line -- 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 (only for plots with one dataset) -- 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.2, 0.7, 0).
  • pos.leg: Position of legend -- one of"bottomright","bottom","bottomleft","left","topleft","top","topright","right"or"center". UseNULLto hide the legend.
  • 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 interspacing factor for legend text, as numeric -- default is0.8.

See Also

weibull

Examples

Run this code
# load and prepare data
data(winddata)
set1 <- createSet(height=40, v.avg=winddata[,2], dir.avg=winddata[,14])
ts <- formatTS(time.stamp=winddata[,1])
neubuerg <- createMast(time.stamp=ts, set1)
neubuerg <- clean(mast=neubuerg)

# calculate Weibull parameters
neubuerg.wb <- weibull(mast=neubuerg, v.set=1, print=FALSE)

# plot
plotWeibull(wb=neubuerg.wb)

# show parameters in legend
plotWeibull(wb=neubuerg.wb, show.ak=TRUE)

# customize plot
plotWeibull(wb=neubuerg.wb, bty="l", bty.leg="l", cex.axis=1.2, 
  cex.lab=1.4, cex.leg=0.9, col.axis="darkgray", 
  col.box="darkgray", col.lab="darkgray", col.leg="darkgray", 
  col.ticks="darkgray", las=0, leg.text=c("measured", "calculated"), 
  mar=c(3,3,0.5,0.5), mgp=c(1.8,0.5,0), pos.leg="right", 
  xlab="velocity [m/s]", ylab="frequency [%]", xlim=c(0,20), 
  ylim=c(0,15), x.intersp=1, y.intersp=1)

# customize bars
plotWeibull(wb=neubuerg.wb, border="darkgray", breaks=seq(0,21,0.5), 
  col="lightgray")

# customize line
plotWeibull(wb=neubuerg.wb, line="black", lty="dotdash", lwd=2)

Run the code above in your browser using DataLab