2020-09-12 08:49:01 +02:00
% Generated by roxygen2: do not edit by hand
2021-02-25 10:33:08 +01:00
% Please edit documentation in R/plot.R
2020-09-12 08:49:01 +02:00
\name{plot}
\alias{plot}
\alias{plot.mic}
2021-06-14 22:04:04 +02:00
\alias{autoplot.mic}
2021-11-01 13:51:13 +01:00
\alias{fortify.mic}
2021-02-25 10:33:08 +01:00
\alias{plot.disk}
2021-06-14 22:04:04 +02:00
\alias{autoplot.disk}
2021-11-01 13:51:13 +01:00
\alias{fortify.disk}
2020-09-12 08:49:01 +02:00
\alias{plot.rsi}
2021-06-14 22:04:04 +02:00
\alias{autoplot.rsi}
2021-11-01 13:51:13 +01:00
\alias{fortify.rsi}
2021-01-18 16:57:56 +01:00
\title{Plotting for Classes \code{rsi}, \code{mic} and \code{disk}}
2020-09-12 08:49:01 +02:00
\usage{
2021-02-25 10:33:08 +01:00
\method{plot}{mic}(
2020-12-12 23:17:29 +01:00
x,
2021-02-25 10:33:08 +01:00
mo = NULL,
ab = NULL,
guideline = "EUCAST",
2021-07-12 20:24:49 +02:00
main = paste("MIC values of", deparse(substitute(x))),
2021-02-25 10:33:08 +01:00
ylab = "Frequency",
xlab = "Minimum Inhibitory Concentration (mg/L)",
colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
2021-03-04 23:28:32 +01:00
language = get_locale(),
2021-02-25 10:33:08 +01:00
expand = TRUE,
...
)
2021-07-12 22:12:28 +02:00
\method{autoplot}{mic}(
2021-07-12 20:24:49 +02:00
object,
2021-06-14 22:04:04 +02:00
mo = NULL,
ab = NULL,
guideline = "EUCAST",
2021-07-12 20:24:49 +02:00
title = paste("MIC values of", deparse(substitute(object))),
ylab = "Frequency",
xlab = "Minimum Inhibitory Concentration (mg/L)",
2021-06-14 22:04:04 +02:00
colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
language = get_locale(),
expand = TRUE,
...
)
2021-11-01 13:51:13 +01:00
\method{fortify}{mic}(object, ...)
2021-02-25 10:33:08 +01:00
\method{plot}{disk}(
2020-09-12 08:49:01 +02:00
x,
2021-02-26 12:11:29 +01:00
main = paste("Disk zones of", deparse(substitute(x))),
2020-09-12 08:49:01 +02:00
ylab = "Frequency",
2021-02-25 10:33:08 +01:00
xlab = "Disk diffusion diameter (mm)",
mo = NULL,
ab = NULL,
guideline = "EUCAST",
colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
2021-03-04 23:28:32 +01:00
language = get_locale(),
2021-02-25 10:33:08 +01:00
expand = TRUE,
2020-09-12 08:49:01 +02:00
...
)
2021-07-12 20:24:49 +02:00
\method{autoplot}{disk}(
object,
2021-02-25 10:33:08 +01:00
mo = NULL,
ab = NULL,
2021-07-12 20:24:49 +02:00
title = paste("Disk zones of", deparse(substitute(object))),
2021-06-14 22:04:04 +02:00
ylab = "Frequency",
xlab = "Disk diffusion diameter (mm)",
guideline = "EUCAST",
colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
language = get_locale(),
expand = TRUE,
...
)
2021-11-01 13:51:13 +01:00
\method{fortify}{disk}(object, ...)
2020-09-12 08:49:01 +02:00
\method{plot}{rsi}(
x,
ylab = "Percentage",
xlab = "Antimicrobial Interpretation",
main = paste("Resistance Overview of", deparse(substitute(x))),
...
)
2021-02-26 12:11:29 +01:00
2021-06-14 22:04:04 +02:00
\method{autoplot}{rsi}(
2021-07-12 20:24:49 +02:00
object,
title = paste("Resistance Overview of", deparse(substitute(object))),
2021-06-14 22:04:04 +02:00
xlab = "Antimicrobial Interpretation",
ylab = "Frequency",
colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
language = get_locale(),
...
)
2021-11-01 13:51:13 +01:00
\method{fortify}{rsi}(object, ...)
2020-09-12 08:49:01 +02:00
}
\arguments{
2021-11-01 13:51:13 +01:00
\item{x, object}{values created with \code{\link[=as.mic]{as.mic()}}, \code{\link[=as.disk]{as.disk()}} or \code{\link[=as.rsi]{as.rsi()}} (or their \verb{random_*} variants, such as \code{\link[=random_mic]{random_mic()}})}
2020-09-12 08:49:01 +02:00
2021-02-25 10:33:08 +01:00
\item{mo}{any (vector of) text that can be coerced to a valid microorganism code with \code{\link[=as.mo]{as.mo()}}}
2020-09-12 08:49:01 +02:00
2021-02-25 10:33:08 +01:00
\item{ab}{any (vector of) text that can be coerced to a valid antimicrobial code with \code{\link[=as.ab]{as.ab()}}}
2020-09-12 08:49:01 +02:00
2021-02-25 10:33:08 +01:00
\item{guideline}{interpretation guideline to use, defaults to the latest included EUCAST guideline, see \emph{Details}}
2020-09-12 08:49:01 +02:00
2021-07-12 20:24:49 +02:00
\item{main, title}{title of the plot}
\item{xlab, ylab}{axis title}
2021-02-25 10:33:08 +01:00
\item{colours_RSI}{colours to use for filling in the bars, must be a vector of three values (in the order R, S and I). The default colours are colour-blind friendly.}
2020-09-12 08:49:01 +02:00
2021-03-04 23:28:32 +01:00
\item{language}{language to be used to translate 'Susceptible', 'Increased exposure'/'Intermediate' and 'Resistant', defaults to system language (see \code{\link[=get_locale]{get_locale()}}) and can be overwritten by setting the option \code{AMR_locale}, e.g. \code{options(AMR_locale = "de")}, see \link{translate}. Use \code{language = NULL} or \code{language = ""} to prevent translation.}
2021-05-12 18:15:03 +02:00
\item{expand}{a \link{logical} to indicate whether the range on the x axis should be expanded between the lowest and highest value. For MIC values, intermediate values will be factors of 2 starting from the highest MIC value. For disk diameters, the whole diameter range will be filled.}
2020-09-12 08:49:01 +02:00
2021-11-01 13:51:13 +01:00
\item{...}{arguments passed on to methods}
2021-02-25 10:33:08 +01:00
}
\value{
2021-07-12 20:24:49 +02:00
The \code{autoplot()} functions return a \code{\link[ggplot2:ggplot]{ggplot}} model that is extendible with any \code{ggplot2} function.
2021-11-01 13:51:13 +01:00
The \code{fortify()} functions return a \link{data.frame} as an extension for usage in the \code{\link[ggplot2:ggplot]{ggplot2::ggplot()}} function.
2020-09-12 08:49:01 +02:00
}
\description{
2021-06-22 12:16:42 +02:00
Functions to plot classes \code{rsi}, \code{mic} and \code{disk}, with support for base \R and \code{ggplot2}.
2021-02-25 10:33:08 +01:00
}
\details{
2021-02-25 12:31:12 +01:00
The interpretation of "I" will be named "Increased exposure" for all EUCAST guidelines since 2019, and will be named "Intermediate" in all other cases.
2021-06-01 15:33:06 +02:00
For interpreting MIC values as well as disk diffusion diameters, supported guidelines to be used as input for the \code{guideline} argument are: "EUCAST 2021", "EUCAST 2020", "EUCAST 2019", "EUCAST 2018", "EUCAST 2017", "EUCAST 2016", "EUCAST 2015", "EUCAST 2014", "EUCAST 2013", "EUCAST 2012", "EUCAST 2011", "CLSI 2020", "CLSI 2019", "CLSI 2018", "CLSI 2017", "CLSI 2016", "CLSI 2015", "CLSI 2014", "CLSI 2013", "CLSI 2012", "CLSI 2011" and "CLSI 2010".
2021-02-25 10:33:08 +01:00
Simply using \code{"CLSI"} or \code{"EUCAST"} as input will automatically select the latest version of that guideline.
2020-09-12 08:49:01 +02:00
}
2021-11-28 23:01:26 +01:00
\section{Stable Lifecycle}{
2020-09-12 08:49:01 +02:00
2021-11-28 23:01:26 +01:00
\if{html}{\figure{lifecycle_stable.svg}{options: style=margin-bottom:5px} \cr}
The \link[=lifecycle]{lifecycle} of this function is \strong{stable}. In a stable function, major changes are unlikely. This means that the unlying code will generally evolve by adding new arguments; removing arguments or changing the meaning of existing arguments will be avoided.
2021-12-05 22:06:45 +01:00
If the unlying code needs breaking changes, they will occur gradually. For example, an argument will be deprecated and first continue to work, but will emit an message informing you of the change. Next, typically after at least one newly released version on CRAN, the message will be transformed to an error.
2020-09-12 08:49:01 +02:00
}
2021-01-18 16:57:56 +01:00
\section{Read more on Our Website!}{
2020-09-12 08:49:01 +02:00
2021-06-01 15:33:06 +02:00
On our website \url{https://msberends.github.io/AMR/} you can find \href{https://msberends.github.io/AMR/articles/AMR.html}{a comprehensive tutorial} about how to conduct AMR data analysis, the \href{https://msberends.github.io/AMR/reference/}{complete documentation of all functions} and \href{https://msberends.github.io/AMR/articles/WHONET.html}{an example analysis using WHONET data}.
2020-09-12 08:49:01 +02:00
}
2021-02-25 10:33:08 +01:00
\examples{
some_mic_values <- random_mic(size = 100)
some_disk_values <- random_disk(size = 100, mo = "Escherichia coli", ab = "cipro")
2021-02-26 12:11:29 +01:00
some_rsi_values <- random_rsi(50, prob_RSI = c(0.30, 0.55, 0.05))
2021-02-25 10:33:08 +01:00
plot(some_mic_values)
plot(some_disk_values)
2021-02-26 12:11:29 +01:00
plot(some_rsi_values)
2021-02-25 10:33:08 +01:00
# when providing the microorganism and antibiotic, colours will show interpretations:
plot(some_mic_values, mo = "S. aureus", ab = "ampicillin")
plot(some_disk_values, mo = "Escherichia coli", ab = "cipro")
2021-05-24 09:00:11 +02:00
\donttest{
2021-02-25 10:33:08 +01:00
if (require("ggplot2")) {
2021-07-12 20:24:49 +02:00
autoplot(some_mic_values)
autoplot(some_disk_values, mo = "Escherichia coli", ab = "cipro")
autoplot(some_rsi_values)
2021-02-25 10:33:08 +01:00
}
}
2021-05-24 09:00:11 +02:00
}