Built site for AMR@3.0.1.9151: 43accd3

This commit is contained in:
github-actions committed 2026-10-15 20:40:28 +00:00
1 parent 170bbeb95a
commit 8dbd7d7f84
106 files changed
+241 -142

No files matched your search

+17 -17
View File
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>Plotting Helpers for AMR Data Analysis — plot • AMR (for R)</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.8/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.8/bootstrap.bundle.min.js"></script><link href="../deps/Lato-0.4.10/font.css" rel="stylesheet"><link href="../deps/Fira_Code-0.4.10/font.css" rel="stylesheet"><link href="../deps/font-awesome-6.5.2/css/all.min.css" rel="stylesheet"><link href="../deps/font-awesome-6.5.2/css/v4-shims.min.css" rel="stylesheet"><script src="../deps/headroom-0.11.0/headroom.min.js"></script><script src="../deps/headroom-0.11.0/jQuery.headroom.min.js"></script><script src="../deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js"></script><script src="../deps/clipboard.js-2.0.11/clipboard.min.js"></script><script src="../deps/search-1.0.0/autocomplete.jquery.min.js"></script><script src="../deps/search-1.0.0/fuse.min.js"></script><script src="../deps/search-1.0.0/mark.min.js"></script><!-- pkgdown --><script src="../pkgdown.js"></script><link href="../extra.css" rel="stylesheet"><script src="../extra.js"></script><meta property="og:title" content="Plotting Helpers for AMR Data Analysis — plot"><meta name="description" content="Functions to plot classes sir, mic and disk, with support for base R and ggplot2.
Especially the scale_*_mic() functions are relevant wrappers to plot MIC values for ggplot2. They allows custom MIC ranges and to plot intermediate log2 levels for missing MIC values."><meta property="og:description" content="Functions to plot classes sir, mic and disk, with support for base R and ggplot2.
Especially the scale_*_mic() functions are relevant wrappers to plot MIC values for ggplot2. They allows custom MIC ranges and to plot intermediate log2 levels for missing MIC values."><meta property="og:image" content="https://amr-for-r.org/logo.svg"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css" integrity="sha384-nB0miv6/jRmo5UMMR1wu3Gz6NLsoTkbqJghGIsx//Rlm+ZU03BU6SQNC66uf4l5+" crossorigin="anonymous"><script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js" integrity="sha384-7zkQWkzuo3B5mTepMUcHkMB5jZaolc2xDwL6VFqjFALcbeS9Ggm/Yr2r3Dy4lfFg" crossorigin="anonymous"></script><script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/auto-render.min.js" integrity="sha384-43gviWU0YVjaDtb/GhzOouOXtZMP/7XUzwPTstBeZFe/+rCMvRwr4yROQP43s0Xk" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script></head><body>
Especially the scale_*_mic() functions are relevant wrappers to plot MIC values for ggplot2. They allow custom MIC ranges and to plot intermediate log2 levels for missing MIC values."><meta property="og:description" content="Functions to plot classes sir, mic and disk, with support for base R and ggplot2.
Especially the scale_*_mic() functions are relevant wrappers to plot MIC values for ggplot2. They allow custom MIC ranges and to plot intermediate log2 levels for missing MIC values."><meta property="og:image" content="https://amr-for-r.org/logo.svg"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css" integrity="sha384-nB0miv6/jRmo5UMMR1wu3Gz6NLsoTkbqJghGIsx//Rlm+ZU03BU6SQNC66uf4l5+" crossorigin="anonymous"><script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js" integrity="sha384-7zkQWkzuo3B5mTepMUcHkMB5jZaolc2xDwL6VFqjFALcbeS9Ggm/Yr2r3Dy4lfFg" crossorigin="anonymous"></script><script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/auto-render.min.js" integrity="sha384-43gviWU0YVjaDtb/GhzOouOXtZMP/7XUzwPTstBeZFe/+rCMvRwr4yROQP43s0Xk" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a>
@@ -9,7 +9,7 @@ Especially the scale_*_mic() functions are relevant wrappers to plot MIC values
<a class="navbar-brand me-2" href="../index.html">AMR (for R)</a>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">3.0.1.9150</small>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">3.0.1.9151</small>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
@@ -53,7 +53,7 @@ Especially the scale_*_mic() functions are relevant wrappers to plot MIC values
<div class="ref-description section level2">
<p>Functions to plot classes <code>sir</code>, <code>mic</code> and <code>disk</code>, with support for base <span style="R">R</span> and <code>ggplot2</code>.</p>
<p>Especially the <code>scale_*_mic()</code> functions are relevant wrappers to plot MIC values for <code>ggplot2</code>. They allows custom MIC ranges and to plot intermediate log2 levels for missing MIC values.</p>
<p>Especially the <code>scale_*_mic()</code> functions are relevant wrappers to plot MIC values for <code>ggplot2</code>. They allow custom MIC ranges and to plot intermediate log2 levels for missing MIC values.</p>
</div>
<div class="section level2">
@@ -69,21 +69,21 @@ Especially the scale_*_mic() functions are relevant wrappers to plot MIC values
<span><span class="fu">scale_x_sir</span><span class="op">(</span></span>
<span> colours_SIR <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span>S <span class="op">=</span> <span class="st">"#3CAEA3"</span>, SDD <span class="op">=</span> <span class="st">"#8FD6C4"</span>, I <span class="op">=</span> <span class="st">"#F6D55C"</span>, R <span class="op">=</span> <span class="st">"#ED553B"</span><span class="op">)</span>,</span>
<span> language <span class="op">=</span> <span class="fu"><a href="translate.html">get_AMR_locale</a></span><span class="op">(</span><span class="op">)</span>,</span>
<span> eucast_I <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/options.html" class="external-link">getOption</a></span><span class="op">(</span><span class="st">"AMR_guideline"</span>, <span class="st">"EUCAST"</span><span class="op">)</span> <span class="op"><a href="like.html">%like%</a></span> <span class="st">"EUCAST"</span>,</span>
<span> eucast_I <span class="op">=</span> <span class="fu">plot_name_of_I</span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/options.html" class="external-link">getOption</a></span><span class="op">(</span><span class="st">"AMR_guideline"</span>, <span class="st">"EUCAST"</span><span class="op">)</span><span class="op">)</span> <span class="op">!=</span> <span class="st">"Intermediate"</span>,</span>
<span> <span class="va">...</span></span>
<span><span class="op">)</span></span>
<span></span>
<span><span class="fu">scale_colour_sir</span><span class="op">(</span></span>
<span> colours_SIR <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span>S <span class="op">=</span> <span class="st">"#3CAEA3"</span>, SDD <span class="op">=</span> <span class="st">"#8FD6C4"</span>, I <span class="op">=</span> <span class="st">"#F6D55C"</span>, R <span class="op">=</span> <span class="st">"#ED553B"</span><span class="op">)</span>,</span>
<span> language <span class="op">=</span> <span class="fu"><a href="translate.html">get_AMR_locale</a></span><span class="op">(</span><span class="op">)</span>,</span>
<span> eucast_I <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/options.html" class="external-link">getOption</a></span><span class="op">(</span><span class="st">"AMR_guideline"</span>, <span class="st">"EUCAST"</span><span class="op">)</span> <span class="op"><a href="like.html">%like%</a></span> <span class="st">"EUCAST"</span>,</span>
<span> eucast_I <span class="op">=</span> <span class="fu">plot_name_of_I</span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/options.html" class="external-link">getOption</a></span><span class="op">(</span><span class="st">"AMR_guideline"</span>, <span class="st">"EUCAST"</span><span class="op">)</span><span class="op">)</span> <span class="op">!=</span> <span class="st">"Intermediate"</span>,</span>
<span> <span class="va">...</span></span>
<span><span class="op">)</span></span>
<span></span>
<span><span class="fu">scale_fill_sir</span><span class="op">(</span></span>
<span> colours_SIR <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span>S <span class="op">=</span> <span class="st">"#3CAEA3"</span>, SDD <span class="op">=</span> <span class="st">"#8FD6C4"</span>, I <span class="op">=</span> <span class="st">"#F6D55C"</span>, R <span class="op">=</span> <span class="st">"#ED553B"</span><span class="op">)</span>,</span>
<span> language <span class="op">=</span> <span class="fu"><a href="translate.html">get_AMR_locale</a></span><span class="op">(</span><span class="op">)</span>,</span>
<span> eucast_I <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/options.html" class="external-link">getOption</a></span><span class="op">(</span><span class="st">"AMR_guideline"</span>, <span class="st">"EUCAST"</span><span class="op">)</span> <span class="op"><a href="like.html">%like%</a></span> <span class="st">"EUCAST"</span>,</span>
<span> eucast_I <span class="op">=</span> <span class="fu">plot_name_of_I</span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/options.html" class="external-link">getOption</a></span><span class="op">(</span><span class="st">"AMR_guideline"</span>, <span class="st">"EUCAST"</span><span class="op">)</span><span class="op">)</span> <span class="op">!=</span> <span class="st">"Intermediate"</span>,</span>
<span> <span class="va">...</span></span>
<span><span class="op">)</span></span>
<span></span>
@@ -209,7 +209,7 @@ Especially the scale_*_mic() functions are relevant wrappers to plot MIC values
<dt id="arg-colours-sir">colours_SIR<a class="anchor" aria-label="anchor" href="#arg-colours-sir"></a></dt>
<dd><p>Colours to use for filling in the bars, must be a vector of three values (in the order S, I and R). The default colours are colour-blind friendly.</p></dd>
<dd><p>Colours to use for filling in the bars, must be a vector of one, three or four values (in the order S, SDD, I and R), or a named vector with at least the names S, I and R. With three values or without a name SDD, SDD gets the colour of S. The default colours are colour-blind friendly.</p></dd>
<dt id="arg-language">language<a class="anchor" aria-label="anchor" href="#arg-language"></a></dt>
@@ -217,7 +217,7 @@ Especially the scale_*_mic() functions are relevant wrappers to plot MIC values
<dt id="arg-eucast-i">eucast_I<a class="anchor" aria-label="anchor" href="#arg-eucast-i"></a></dt>
<dd><p>A <a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a> to indicate whether the 'I' must be interpreted as "Susceptible, under increased exposure". Will be <code>TRUE</code> if the default <a href="as.sir.html">AMR interpretation guideline</a> is set to EUCAST (which is the default). With <code>FALSE</code>, it will be interpreted as "Intermediate".</p></dd>
<dd><p>A <a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a> to indicate whether the 'I' must be interpreted as "Susceptible, under increased exposure". Will be <code>TRUE</code> if the default <a href="as.sir.html">AMR interpretation guideline</a> is set to EUCAST 2019 or later (which is the default). With <code>FALSE</code>, it will be interpreted as "Intermediate".</p></dd>
<dt id="arg-x-object">x, object<a class="anchor" aria-label="anchor" href="#arg-x-object"></a></dt>
@@ -287,7 +287,7 @@ Especially the scale_*_mic() functions are relevant wrappers to plot MIC values
<h3 id="the-scale-mic-functions">The <code>scale_*_mic()</code> Functions<a class="anchor" aria-label="anchor" href="#the-scale-mic-functions"></a></h3>
<p>The functions <code>scale_x_mic()</code>, <code>scale_y_mic()</code>, <code>scale_colour_mic()</code>, and <code>scale_fill_mic()</code> functions allow to plot the <a href="as.mic.html">mic</a> class (MIC values) on a continuous, logarithmic scale.</p>
<p>The functions <code>scale_x_mic()</code>, <code>scale_y_mic()</code>, <code>scale_colour_mic()</code>, and <code>scale_fill_mic()</code> allow to plot the <a href="as.mic.html">mic</a> class (MIC values) on a continuous, logarithmic scale.</p>
<p>There is normally no need to add these scale functions to your plot, as they are applied automatically when plotting values of class <a href="as.mic.html">mic</a>.</p>
<p>When manually added though, they allow to rescale the MIC range with an 'inside' or 'outside' range if required, and provide the option to retain the operators in MIC values (such as <code>&gt;=</code>). Missing intermediate log2 levels will always be plotted too.</p>
</div>
@@ -296,7 +296,7 @@ Especially the scale_*_mic() functions are relevant wrappers to plot MIC values
<h3 id="the-scale-sir-functions">The <code>scale_*_sir()</code> Functions<a class="anchor" aria-label="anchor" href="#the-scale-sir-functions"></a></h3>
<p>The functions <code>scale_x_sir()</code>, <code>scale_colour_sir()</code>, and <code>scale_fill_sir()</code> functions allow to plot the <a href="as.sir.html">sir</a> class in the right order (S &lt; SDD &lt; I &lt; R &lt; NI &lt; WT &lt; NWT &lt; NS).</p>
<p>The functions <code>scale_x_sir()</code>, <code>scale_colour_sir()</code>, and <code>scale_fill_sir()</code> allow to plot the <a href="as.sir.html">sir</a> class in the right order (S &lt; SDD &lt; I &lt; R &lt; NI &lt; WT &lt; NWT &lt; NS).</p>
<p>There is normally no need to add these scale functions to your plot, as they are applied automatically when plotting values of class <a href="as.sir.html">sir</a>.</p>
<p>At default, they translate the S/I/R values to an interpretative text ("Susceptible", "Resistant", etc.) in any of the 28 supported languages (use <code>language = NULL</code> to keep S/I/R). Also, except for <code>scale_x_sir()</code>, they set colour-blind friendly colours to the <code>colour</code> and <code>fill</code> aesthetics.</p>
</div>
@@ -309,8 +309,8 @@ Especially the scale_*_mic() functions are relevant wrappers to plot MIC values
<li><p><code>scale_y_percent()</code> transforms the y axis to a 0 to 100% range using <code><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html" class="external-link">ggplot2::scale_y_continuous()</a></code>.</p></li>
<li><p><code>scale_sir_colours()</code> allows to set colours to any aesthetic, even for <code>shape</code> or <code>linetype</code>.</p></li>
<li><p><code>theme_sir()</code> is a <a href="https://ggplot2.tidyverse.org/reference/theme.html" class="external-link">ggplot2 theme</a> with minimal distraction.</p></li>
<li><p><code><a href="ggplot_sir.html">labels_sir_count()</a></code> print datalabels on the bars with percentage and number of isolates, using <code><a href="https://ggplot2.tidyverse.org/reference/geom_text.html" class="external-link">ggplot2::geom_text()</a></code>.</p></li>
</ul><p>The interpretation of "I" will be named "Increased exposure" for all EUCAST guidelines since 2019, and will be named "Intermediate" in all other cases.</p>
<li><p><code><a href="ggplot_sir.html">labels_sir_count()</a></code> prints data labels on the bars with percentage and number of isolates, using <code><a href="https://ggplot2.tidyverse.org/reference/geom_text.html" class="external-link">ggplot2::geom_text()</a></code>.</p></li>
</ul><p>The interpretation of "I" will be named "Susceptible, incr. exp." (susceptible, increased exposure) for all EUCAST guidelines since 2019, and will be named "Intermediate" in all other cases.</p>
<p>For interpreting MIC values as well as disk diffusion diameters, the default guideline is EUCAST 2026, unless the package option <code><a href="AMR-options.html">AMR_guideline</a></code> is set. See <code><a href="as.sir.html">as.sir()</a></code> for more information.</p>
</div>
@@ -339,7 +339,7 @@ Especially the scale_*_mic() functions are relevant wrappers to plot MIC values
<span class="r-plt img"><img src="plot-3.png" alt="" width="700" height="433"></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">require</a></span><span class="op">(</span><span class="st"><a href="https://ggplot2.tidyverse.org" class="external-link">"ggplot2"</a></span><span class="op">)</span><span class="op">)</span> <span class="op">{</span></span></span>
<span class="r-in"><span> <span class="co"># support for 27 languages, various guidelines, and many options</span></span></span>
<span class="r-in"><span> <span class="co"># support for all languages in ?translate, various guidelines, and many options</span></span></span>
<span class="r-in"><span> <span class="fu"><a href="https://ggplot2.tidyverse.org/reference/autoplot.html" class="external-link">autoplot</a></span><span class="op">(</span><span class="va">some_disk_values</span>,</span></span>
<span class="r-in"><span> mo <span class="op">=</span> <span class="st">"Escherichia coli"</span>, ab <span class="op">=</span> <span class="st">"cipro"</span>,</span></span>
<span class="r-in"><span> guideline <span class="op">=</span> <span class="st">"CLSI"</span>, language <span class="op">=</span> <span class="st">"no"</span>,</span></span>
@@ -444,8 +444,8 @@ Especially the scale_*_mic() functions are relevant wrappers to plot MIC values
<span class="r-in"><span> <span class="op">)</span> <span class="op">+</span></span></span>
<span class="r-in"><span> <span class="fu"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html" class="external-link">theme_minimal</a></span><span class="op">(</span><span class="op">)</span> <span class="op">+</span></span></span>
<span class="r-in"><span> <span class="fu"><a href="https://ggplot2.tidyverse.org/reference/geom_boxplot.html" class="external-link">geom_boxplot</a></span><span class="op">(</span>fill <span class="op">=</span> <span class="cn">NA</span>, colour <span class="op">=</span> <span class="st">"grey30"</span><span class="op">)</span> <span class="op">+</span></span></span>
<span class="r-in"><span> <span class="fu"><a href="https://ggplot2.tidyverse.org/reference/geom_jitter.html" class="external-link">geom_jitter</a></span><span class="op">(</span>width <span class="op">=</span> <span class="fl">0.25</span><span class="op">)</span></span></span>
<span class="r-in"><span> <span class="fu"><a href="https://ggplot2.tidyverse.org/reference/labs.html" class="external-link">labs</a></span><span class="op">(</span>title <span class="op">=</span> <span class="st">"scale_y_mic()/scale_colour_sir() automatically applied"</span><span class="op">)</span></span></span>
<span class="r-in"><span> <span class="fu"><a href="https://ggplot2.tidyverse.org/reference/geom_jitter.html" class="external-link">geom_jitter</a></span><span class="op">(</span>width <span class="op">=</span> <span class="fl">0.25</span><span class="op">)</span> <span class="op">+</span></span></span>
<span class="r-in"><span> <span class="fu"><a href="https://ggplot2.tidyverse.org/reference/labs.html" class="external-link">labs</a></span><span class="op">(</span>title <span class="op">=</span> <span class="st">"scale_y_mic()/scale_colour_sir() automatically applied"</span><span class="op">)</span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span> <span class="va">mic_sir_plot</span></span></span>
<span class="r-in"><span><span class="op">}</span></span></span>
@@ -455,7 +455,7 @@ Especially the scale_*_mic() functions are relevant wrappers to plot MIC values
<span class="r-in"><span> <span class="fu">scale_y_mic</span><span class="op">(</span>mic_range <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="fl">0.005</span>, <span class="fl">32</span><span class="op">)</span>, name <span class="op">=</span> <span class="st">"Our MICs!"</span><span class="op">)</span> <span class="op">+</span></span></span>
<span class="r-in"><span> <span class="fu">scale_colour_sir</span><span class="op">(</span></span></span>
<span class="r-in"><span> language <span class="op">=</span> <span class="st">"pt"</span>, <span class="co"># Portuguese</span></span></span>
<span class="r-in"><span> name <span class="op">=</span> <span class="st">"Support in 28 languages"</span></span></span>
<span class="r-in"><span> name <span class="op">=</span> <span class="st">"Support in many languages"</span></span></span>
<span class="r-in"><span> <span class="op">)</span></span></span>
<span class="r-in"><span><span class="op">}</span></span></span>
<span class="r-plt img"><img src="plot-13.png" alt="" width="700" height="433"></span>