plotFun.heat | R Documentation |
Plot heat index as a function of the input variables. The index is calculated with the R package HeatStress
or provided as a vector by the user.
plotFun.heat(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)
hu |
vector with data for the variable to be plotted in the X-axis or relative humidity data. |
td |
vector with data for the variable to be plotted in the X-axis or dew point temperature data. |
ta |
vector with with data for the variable to be plotted in the Y-axis or temperature data. |
xlim |
2-element vector with X-axis limits for the density plot. Default: range of hu/td. |
ylim |
2-element vector with Y-axis limits for the density plot. Default: range of ta. |
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. |
breaks.index |
vector of breaks for the heat index values. By default, breaks is adjusted to the minimum and maximum values of the index. |
title |
title above the plot. |
cex.main |
Relative size of the plot title. Default:1.5. |
xlab |
X-axis label. |
ylab |
Y-axis label. |
n.bins |
number of bins for kernel density calculation, only when 'heat.index' is a character. Default= 500 |
add.points |
logical. Add (default) or not points with the actual time series. It is only valid when 'heat.index' is a character. |
add.contours |
logical. Add (default) or not contours for heat index values. It is only valid when 'heat.index' is a character. |
unit.text |
character string to be placed in the colorbar with the units. |
cex.unit |
numeric value giving the expansion factor of the units text. Default:1. |
cex.textcbar |
numeric value giving the expansion factor of the colorbar text. Default:1.3. |
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. 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'.
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.
Ana Casanueva, 14.08.2019
## Not run: # Generate data tas <- rnorm(150, mean=15, sd=2) dew <- rnorm(150, mean=8, sd=1) hurs <- sample(1:100,150, replace=T) # Plot the heat plot plotFun.heat(hu=hurs, ta=tas, heat.index="wbt", title="Heat stress plot", cex.main=1.5, xlab="Relative Humidity", ylab="Air temp.", n.bins=500) # Add points, change index plotFun.heat(hu=hurs, ta=tas, heat.index="swbgt", title="Heat stress plot", cex.main=1.5, xlab="Relative Humidity", ylab="Air temp.", n.bins=500, add.points=F) # Add contours, change index plotFun.heat(td=dew, ta=tas, heat.index="wbgt.shade", title="Heat stress plot", cex.main=1.5, xlab="Dew point temp.", ylab="Air temp.", n.bins=500, add.contours=F) # Plot only scatter plot with coloured markers hi <- runif(150, -2,5) + 90 plotFun.heat(td=dew, ta=tas, heat.index = hi, ylab="Ta", xlab="Td", unit.text = "degC") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.