PlotPerformanceByAttribute {HYPEtools} | R Documentation |
Plot model performance by SUBID attributes
Description
Create scatterplots of model performance by SUBID attributes.
Usage
PlotPerformanceByAttribute(
subass,
subass.column = 2,
groups = NULL,
attributes,
join.type = c("join", "cbind"),
group.join.type = c("join", "cbind"),
groups.color.pal = NULL,
drop = TRUE,
alpha = 0.4,
trendline = TRUE,
trendline.method = "lm",
trendline.formula = NULL,
trendline.alpha = 0.5,
trendline.darken = 15,
density.plot = FALSE,
density.plot.type = c("density", "boxplot"),
scale.x.log = FALSE,
scale.y.log = FALSE,
xsigma = 1,
ysigma = 1,
xlimits = c(NA, NA),
ylimits = c(NA, NA),
xbreaks = waiver(),
ybreaks = waiver(),
xlabels = waiver(),
ylabels = waiver(),
xlab = NULL,
ylab = NULL,
ncol = NULL,
nrow = NULL,
align = "hv",
common.legend = TRUE,
legend.position = "bottom",
group.legend.title = "Group",
common.y.axis = FALSE,
summary.table = FALSE,
table.margin = 0.4,
filename = NULL,
width = NA,
height = NA,
units = c("in", "cm", "mm", "px"),
dpi = 300
)
PlotJohan(
subass,
subass.column = 2,
groups = NULL,
attributes,
join.type = c("join", "cbind"),
group.join.type = c("join", "cbind"),
groups.color.pal = NULL,
drop = TRUE,
alpha = 0.4,
trendline = TRUE,
trendline.method = "lm",
trendline.formula = NULL,
trendline.alpha = 0.5,
trendline.darken = 15,
density.plot = FALSE,
density.plot.type = c("density", "boxplot"),
scale.x.log = FALSE,
scale.y.log = FALSE,
xsigma = 1,
ysigma = 1,
xlimits = c(NA, NA),
ylimits = c(NA, NA),
xbreaks = waiver(),
ybreaks = waiver(),
xlabels = waiver(),
ylabels = waiver(),
xlab = NULL,
ylab = NULL,
ncol = NULL,
nrow = NULL,
align = "hv",
common.legend = TRUE,
legend.position = "bottom",
group.legend.title = "Group",
common.y.axis = FALSE,
summary.table = FALSE,
table.margin = 0.4,
filename = NULL,
width = NA,
height = NA,
units = c("in", "cm", "mm", "px"),
dpi = 300
)
Arguments
subass |
Information to plot, typically model performances from imported HYPE 'subassX.txt' files. Data frame object with first column containing SUBIDs and additional columns containing model results to plot. See details. |
subass.column |
Column index of information in |
groups |
Optional data frame object to specify groups of SUBIDs to plot separately. First column should contain SUBIDs and second column should contain group IDs. |
attributes |
Data frame object containing the subbasin attribute information to plot on the x-axis of the output plots. Typically a data frame created by |
join.type |
Specify how to join |
group.join.type |
Specify how to join |
groups.color.pal |
Vector containing colors to use when plotting groups. Only used if groups is not |
drop |
Logical, should unused factor levels be omitted from the legend. See |
alpha |
Numeric value to set transparency of dots in output plots. Should be in the range 0-1. |
trendline |
Logical, if |
trendline.method |
Specify method used to create trendlines. See |
trendline.formula |
Specify formula used to create trendlines. See |
trendline.alpha |
Numeric value to set transparency of trendlines in output plots. Should be in the range 0-1. |
trendline.darken |
Numeric value to make the trendlines darker color shades of their corresponding scatterplot points. Should be in the range 1-100. |
density.plot |
Logical, if |
density.plot.type |
String, type of plot geometry to use for density plots: |
scale.x.log |
Vector describing if output plots should use a log scale on the x-axis. A pseudo-log scale will be used if any zero or negative values are present. If length of vector == 1, then the value will be used for all output plots. Vector values should be either |
scale.y.log |
Vector describing if output plots should use a log scale on the y-axis. A pseudo-log scale will be used if any zero or negative values are present. If length of vector == 1, then the value will be used for all output plots. Vector values should be either |
xsigma |
Numeric, scaling factor for the linear part of psuedo-long transformation of x axis. Used if |
ysigma |
Numeric, scaling factor for the linear part of psuedo-long transformation of y axis. Used if |
xlimits |
Vector containing minimum and maximum values for the x-axis of the output plots. See |
ylimits |
Vector containing minimum and maximum values for the y-axis of the output plots. See |
xbreaks |
Vector containing the break values used for the x-axis of the output plots. See |
ybreaks |
Vector containing the break values used for the y-axis of the output plots. See |
xlabels |
Vector containing the labels for each break value used for the x-axis of the output plots. See |
ylabels |
Vector containing the labels for each break value used for the y-axis of the output plots. See |
xlab |
String containing the text to use for the x-axis title of the output plots. See |
ylab |
String containing the text to use for the y-axis title of the output plots. See |
ncol |
Integer, number of columns to use in the output arranged plot. See |
nrow |
Integer, number of rows to use in the output arranged plot. See |
align |
Specify how output plots should be arranged. See |
common.legend |
Specify if arranged plot should use a common legend. See |
legend.position |
Specify position of common legend for arranged plot. See |
group.legend.title |
String, title for plot legend when generating plots with |
common.y.axis |
Logical, if |
summary.table |
Logical, if |
table.margin |
Numeric, controls spacing between plots and summary table. |
filename |
String, filename used to save plot. File extension must be specified. See |
width |
Numeric, specify width of output plot. See |
height |
Numeric, specify height of output plot. See |
units |
Specify units of |
dpi |
Specify resolution of output plot. See |
Details
PlotPerformanceByAttribute
can be used to analyze model performance according to subbasin attributes. The function requires two primary inputs; Model performance
information is contained in the subass
input, and subbasin attribute information is contained in the attributes
input. The subass.column
argument controls
which column of the subass
data frame will be used as the y-coordinate of points. Plots will be generated for each column in the attributes
data frame
(except for the column named "SUBID") using the column values as the x-coordinate of the points.
A subbasin attribute summary table can be generated using SubidAttributeSummary
, and additional columns can be joined to the data frame to add additional output plots.
Value
PlotPerformanceByAttribute
returns a plot to the currently active plot device.
See Also
ReadSubass
for HYPE result import; SubidAttributeSummary
for subbasin attribute summary
Examples
subass <- ReadSubass(filename = system.file("demo_model", "results",
"subass1.txt",
package = "HYPEtools"
), check.names = TRUE)
gd <- ReadGeoData(filename = system.file("demo_model",
"GeoData.txt",
package = "HYPEtools"
))
gc <- ReadGeoClass(filename = system.file("demo_model",
"GeoClass.txt",
package = "HYPEtools"
))
attributes <- SubidAttributeSummary(subids <- subass$SUBID,
gd = gd, gc = gc,
mapoutputs = c(system.file("demo_model", "results", "mapCOUT.txt", package = "HYPEtools")),
upstream.gd.cols = c("SLOPE_MEAN")
)
PlotPerformanceByAttribute(
subass = subass,
attributes = attributes[, c("SUBID", "landuse_1", "landuse_2", "landuse_3")],
xlimits = c(0, 1)
)