Skip to content

Commit e64d942

Browse files
committed
edit documentation
1 parent 4bb020c commit e64d942

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

R/plotFun.heat.R

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
#' Plot heat index as a function of the input variables.
22
#'
3-
#' The index is calculated with the R package \code{HeatStress} or provided by the user.
3+
#' Plot heat index as a function of the input variables. The index is calculated with the R package \code{HeatStress} or provided as a vector by the user.
44
#'
55
#' @param hu vector with data for the variable to be plotted in the X-axis or relative humidity data. \code{hu} or \code{td} are mandatory.
6-
#' @param td vector with data for the variable to be plotted in the X-axis or dew point temperature data.\code{hu} or \code{td} are mandatory.
6+
#' @param td vector with data for the variable to be plotted in the X-axis or dew point temperature data. \code{hu} or \code{td} are mandatory.
77
#' @param ta vector with with data for the variable to be plotted in the Y-axis or temperature data.
88
#' @param heat.index vector with data to plot with colour markers or character with the heat index to plot as a function of the two input variables. Available (based on 2 variables): swbgt, hi, wbt.Stull, wbgt.Bernard, apparentTemp, effectiveTemp, humidex, discomInd.
99
#' @param xlim 2-element vector with X-axis limits for the density plot. Default: range of hu/td.
1010
#' @param ylim 2-element vector with Y-axis limits for the density plot. Default: range of ta.
1111
#' @param breaks.index vector of breaks for the heat index values. By default, breaks is adjusted to the minimum and maximum values of the index.
1212
#' @param n.bins number of bins for kernel density calculation, only when 'heat.index' is a character. Default= 500
1313
#' @param add.contours logical. Add (default) or not contours for heat index values. It is only valid when 'heat.index' is a character.
14-
#' @param add.points logical. Add (default) or not points with the actual time series. It is only valid when 'heat.index' is a character
14+
#' @param add.points logical. Add (default) or not points with the actual time series. It is only valid when 'heat.index' is a character.
1515
#' @param xlab X-axis label.
1616
#' @param ylab Y-axis label.
1717
#' @param title title above the plot.
@@ -20,10 +20,10 @@
2020
#' @param cex.unit numeric value giving the expansion factor of the units text. Default:1.
2121
#' @param cex.textcbar numeric value giving the expansion factor of the colorbar text. Default:1.3.
2222
#' @return Scatter (if 'heat.index' is a vector) or image (if 'heat.index' is a character) plot with the heat index values as a function of the input variables.
23-
#' @details When 'heat.index' is a character, the index is calculated and the two input variables of the desired index need to be provided, tas and either td or hu. Needed packages: HeatStress, RColorBrewer.
24-
#' When 'heat.index' is a vector, the variable to be plotted in the X-axis should be included in 'hu' or 'td' and the plotted in the Y-axis in 'ta'.
23+
#' @details When 'heat.index' is a \strong{character}, the index is calculated and the two input variables of the desired index need to be provided, tas and either td or hu. Needed packages: HeatStress, RColorBrewer.
24+
#' When 'heat.index' is a \strong{vector}, the variable to be plotted in the X-axis should be included in 'hu' or 'td' and the plotted in the Y-axis in 'ta'.
2525
#' @import HeatStress RColorBrewer
26-
#' @author Ana Casanueva, 13.12.2018
26+
#' @author Ana Casanueva, 14.08.2019
2727
#' @export plotFun.heat
2828
#' @examples \dontrun{
2929
#' # Generate data
@@ -39,11 +39,15 @@
3939
#' # Add contours, change index
4040
#' plotFun.heat(td=dew, ta=tas, heat.index="wbgt.shade", title="Heat stress plot", cex.main=1.5,
4141
#' xlab="Dew point temp.", ylab="Air temp.", n.bins=500, add.contours=F)
42+
#' # Plot only scatter plot with coloured markers
43+
#' hi <- runif(150, -2,5) + 90
44+
#' plotFun.heat(td=dew, ta=tas, heat.index = hi, ylab="Ta", xlab="Td", unit.text = "degC")
4245
#' }
4346

4447

4548

4649

50+
4751
plotFun.heat <- function(hu=NULL, td=NULL, ta, xlim=NULL, ylim=range(ta, na.rm=T), heat.index=NULL, breaks.index=NULL, title=NULL, cex.main=1.5, xlab=NULL, ylab=NULL, n.bins=500, add.points=TRUE, add.contours=TRUE, unit.text=NULL, cex.unit=1, cex.textcbar=1.3){
4852

4953

@@ -114,7 +118,7 @@ plotFun.heat <- function(hu=NULL, td=NULL, ta, xlim=NULL, ylim=range(ta, na.rm=T
114118
} else{
115119
class <- classInt::classIntervals(heat.index, lev, style = "fixed", fixedBreaks=breaks.index)
116120
colcode <- classInt::findColours(class,cols)
117-
plot(df$x, df$y, bg=colcode, pch=21, xaxs="i", yaxs="i", xlim= xlim, ylim=ylim,las=1, cex=2, lwd=1, xlab=NA, ylab=NA)
121+
plot(df$x, df$y, bg=colcode, pch=21, xaxs="i", yaxs="i", xlim= xlim, ylim=ylim,las=1, cex=2, lwd=1, xlab=NA, ylab=NA, cex.axis=1.5, main=title, cex.main=cex.main)
118122
}
119123

120124
# add labels for the axis

man/plotFun.heat.Rd

Lines changed: 9 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)