View source: R/function_PlotPerformanceByAttribute.R
PlotPerformanceByAttribute | R Documentation |
Create scatterplots of model performance by SUBID attributes.
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
)
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 ggplot2::scale_color_manual and ggplot2::scale_fill_manual. |
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 ggplot2::geom_smooth. |
trendline.formula |
Specify formula used to create trendlines. See ggplot2::geom_smooth. |
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 ggplot2::scale_x_continuous. |
ylimits |
Vector containing minimum and maximum values for the y-axis of the output plots. See ggplot2::scale_y_continuous. |
xbreaks |
Vector containing the break values used for the x-axis of the output plots. See ggplot2::scale_x_continuous. |
ybreaks |
Vector containing the break values used for the y-axis of the output plots. See ggplot2::scale_y_continuous. |
xlabels |
Vector containing the labels for each break value used for the x-axis of the output plots. See ggplot2::scale_x_continuous. |
ylabels |
Vector containing the labels for each break value used for the y-axis of the output plots. See ggplot2::scale_y_continuous. |
xlab |
String containing the text to use for the x-axis title of the output plots. See ggplot2::xlab. |
ylab |
String containing the text to use for the y-axis title of the output plots. See ggplot2::ylab. |
ncol |
Integer, number of columns to use in the output arranged plot. See ggpubr::ggarrange. |
nrow |
Integer, number of rows to use in the output arranged plot. See ggpubr::ggarrange. |
align |
Specify how output plots should be arranged. See ggpubr::ggarrange. |
common.legend |
Specify if arranged plot should use a common legend. See ggpubr::ggarrange. |
legend.position |
Specify position of common legend for arranged plot. See ggpubr::ggarrange. Use |
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 ggplot2::ggsave. |
width |
Numeric, specify width of output plot. See ggplot2::ggsave. |
height |
Numeric, specify height of output plot. See ggplot2::ggsave. |
units |
Specify units of |
dpi |
Specify resolution of output plot. See ggplot2::ggsave. |
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.
PlotPerformanceByAttribute
returns a plot to the currently active plot device.
ReadSubass
for HYPE result import; SubidAttributeSummary
for subbasin attribute summary
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)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.