524 lines
86 KiB
HTML
524 lines
86 KiB
HTML
|
<!DOCTYPE html>
|
||
|
|
||
|
<html>
|
||
|
|
||
|
<head>
|
||
|
|
||
|
<meta charset="utf-8" />
|
||
|
<meta name="generator" content="pandoc" />
|
||
|
<meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
|
||
|
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||
|
|
||
|
<meta name="author" content="Claus O. Wilke" />
|
||
|
|
||
|
<meta name="date" content="2022-12-19" />
|
||
|
|
||
|
<title>Generating isolines and isobands</title>
|
||
|
|
||
|
<script>// Pandoc 2.9 adds attributes on both header and div. We remove the former (to
|
||
|
// be compatible with the behavior of Pandoc < 2.8).
|
||
|
document.addEventListener('DOMContentLoaded', function(e) {
|
||
|
var hs = document.querySelectorAll("div.section[class*='level'] > :first-child");
|
||
|
var i, h, a;
|
||
|
for (i = 0; i < hs.length; i++) {
|
||
|
h = hs[i];
|
||
|
if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6
|
||
|
a = h.attributes;
|
||
|
while (a.length > 0) h.removeAttribute(a[0].name);
|
||
|
}
|
||
|
});
|
||
|
</script>
|
||
|
|
||
|
<style type="text/css">
|
||
|
code{white-space: pre-wrap;}
|
||
|
span.smallcaps{font-variant: small-caps;}
|
||
|
span.underline{text-decoration: underline;}
|
||
|
div.column{display: inline-block; vertical-align: top; width: 50%;}
|
||
|
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
|
||
|
ul.task-list{list-style: none;}
|
||
|
</style>
|
||
|
|
||
|
|
||
|
|
||
|
<style type="text/css">
|
||
|
code {
|
||
|
white-space: pre;
|
||
|
}
|
||
|
.sourceCode {
|
||
|
overflow: visible;
|
||
|
}
|
||
|
</style>
|
||
|
<style type="text/css" data-origin="pandoc">
|
||
|
pre > code.sourceCode { white-space: pre; position: relative; }
|
||
|
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
|
||
|
pre > code.sourceCode > span:empty { height: 1.2em; }
|
||
|
.sourceCode { overflow: visible; }
|
||
|
code.sourceCode > span { color: inherit; text-decoration: inherit; }
|
||
|
div.sourceCode { margin: 1em 0; }
|
||
|
pre.sourceCode { margin: 0; }
|
||
|
@media screen {
|
||
|
div.sourceCode { overflow: auto; }
|
||
|
}
|
||
|
@media print {
|
||
|
pre > code.sourceCode { white-space: pre-wrap; }
|
||
|
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
|
||
|
}
|
||
|
pre.numberSource code
|
||
|
{ counter-reset: source-line 0; }
|
||
|
pre.numberSource code > span
|
||
|
{ position: relative; left: -4em; counter-increment: source-line; }
|
||
|
pre.numberSource code > span > a:first-child::before
|
||
|
{ content: counter(source-line);
|
||
|
position: relative; left: -1em; text-align: right; vertical-align: baseline;
|
||
|
border: none; display: inline-block;
|
||
|
-webkit-touch-callout: none; -webkit-user-select: none;
|
||
|
-khtml-user-select: none; -moz-user-select: none;
|
||
|
-ms-user-select: none; user-select: none;
|
||
|
padding: 0 4px; width: 4em;
|
||
|
color: #aaaaaa;
|
||
|
}
|
||
|
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
|
||
|
div.sourceCode
|
||
|
{ }
|
||
|
@media screen {
|
||
|
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
|
||
|
}
|
||
|
code span.al { color: #ff0000; font-weight: bold; }
|
||
|
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; }
|
||
|
code span.at { color: #7d9029; }
|
||
|
code span.bn { color: #40a070; }
|
||
|
code span.bu { color: #008000; }
|
||
|
code span.cf { color: #007020; font-weight: bold; }
|
||
|
code span.ch { color: #4070a0; }
|
||
|
code span.cn { color: #880000; }
|
||
|
code span.co { color: #60a0b0; font-style: italic; }
|
||
|
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; }
|
||
|
code span.do { color: #ba2121; font-style: italic; }
|
||
|
code span.dt { color: #902000; }
|
||
|
code span.dv { color: #40a070; }
|
||
|
code span.er { color: #ff0000; font-weight: bold; }
|
||
|
code span.ex { }
|
||
|
code span.fl { color: #40a070; }
|
||
|
code span.fu { color: #06287e; }
|
||
|
code span.im { color: #008000; font-weight: bold; }
|
||
|
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; }
|
||
|
code span.kw { color: #007020; font-weight: bold; }
|
||
|
code span.op { color: #666666; }
|
||
|
code span.ot { color: #007020; }
|
||
|
code span.pp { color: #bc7a00; }
|
||
|
code span.sc { color: #4070a0; }
|
||
|
code span.ss { color: #bb6688; }
|
||
|
code span.st { color: #4070a0; }
|
||
|
code span.va { color: #19177c; }
|
||
|
code span.vs { color: #4070a0; }
|
||
|
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; }
|
||
|
</style>
|
||
|
<script>
|
||
|
// apply pandoc div.sourceCode style to pre.sourceCode instead
|
||
|
(function() {
|
||
|
var sheets = document.styleSheets;
|
||
|
for (var i = 0; i < sheets.length; i++) {
|
||
|
if (sheets[i].ownerNode.dataset["origin"] !== "pandoc") continue;
|
||
|
try { var rules = sheets[i].cssRules; } catch (e) { continue; }
|
||
|
var j = 0;
|
||
|
while (j < rules.length) {
|
||
|
var rule = rules[j];
|
||
|
// check if there is a div.sourceCode rule
|
||
|
if (rule.type !== rule.STYLE_RULE || rule.selectorText !== "div.sourceCode") {
|
||
|
j++;
|
||
|
continue;
|
||
|
}
|
||
|
var style = rule.style.cssText;
|
||
|
// check if color or background-color is set
|
||
|
if (rule.style.color === '' && rule.style.backgroundColor === '') {
|
||
|
j++;
|
||
|
continue;
|
||
|
}
|
||
|
// replace div.sourceCode by a pre.sourceCode rule
|
||
|
sheets[i].deleteRule(j);
|
||
|
sheets[i].insertRule('pre.sourceCode{' + style + '}', j);
|
||
|
}
|
||
|
}
|
||
|
})();
|
||
|
</script>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<style type="text/css">body {
|
||
|
background-color: #fff;
|
||
|
margin: 1em auto;
|
||
|
max-width: 700px;
|
||
|
overflow: visible;
|
||
|
padding-left: 2em;
|
||
|
padding-right: 2em;
|
||
|
font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||
|
font-size: 14px;
|
||
|
line-height: 1.35;
|
||
|
}
|
||
|
#TOC {
|
||
|
clear: both;
|
||
|
margin: 0 0 10px 10px;
|
||
|
padding: 4px;
|
||
|
width: 400px;
|
||
|
border: 1px solid #CCCCCC;
|
||
|
border-radius: 5px;
|
||
|
background-color: #f6f6f6;
|
||
|
font-size: 13px;
|
||
|
line-height: 1.3;
|
||
|
}
|
||
|
#TOC .toctitle {
|
||
|
font-weight: bold;
|
||
|
font-size: 15px;
|
||
|
margin-left: 5px;
|
||
|
}
|
||
|
#TOC ul {
|
||
|
padding-left: 40px;
|
||
|
margin-left: -1.5em;
|
||
|
margin-top: 5px;
|
||
|
margin-bottom: 5px;
|
||
|
}
|
||
|
#TOC ul ul {
|
||
|
margin-left: -2em;
|
||
|
}
|
||
|
#TOC li {
|
||
|
line-height: 16px;
|
||
|
}
|
||
|
table {
|
||
|
margin: 1em auto;
|
||
|
border-width: 1px;
|
||
|
border-color: #DDDDDD;
|
||
|
border-style: outset;
|
||
|
border-collapse: collapse;
|
||
|
}
|
||
|
table th {
|
||
|
border-width: 2px;
|
||
|
padding: 5px;
|
||
|
border-style: inset;
|
||
|
}
|
||
|
table td {
|
||
|
border-width: 1px;
|
||
|
border-style: inset;
|
||
|
line-height: 18px;
|
||
|
padding: 5px 5px;
|
||
|
}
|
||
|
table, table th, table td {
|
||
|
border-left-style: none;
|
||
|
border-right-style: none;
|
||
|
}
|
||
|
table thead, table tr.even {
|
||
|
background-color: #f7f7f7;
|
||
|
}
|
||
|
p {
|
||
|
margin: 0.5em 0;
|
||
|
}
|
||
|
blockquote {
|
||
|
background-color: #f6f6f6;
|
||
|
padding: 0.25em 0.75em;
|
||
|
}
|
||
|
hr {
|
||
|
border-style: solid;
|
||
|
border: none;
|
||
|
border-top: 1px solid #777;
|
||
|
margin: 28px 0;
|
||
|
}
|
||
|
dl {
|
||
|
margin-left: 0;
|
||
|
}
|
||
|
dl dd {
|
||
|
margin-bottom: 13px;
|
||
|
margin-left: 13px;
|
||
|
}
|
||
|
dl dt {
|
||
|
font-weight: bold;
|
||
|
}
|
||
|
ul {
|
||
|
margin-top: 0;
|
||
|
}
|
||
|
ul li {
|
||
|
list-style: circle outside;
|
||
|
}
|
||
|
ul ul {
|
||
|
margin-bottom: 0;
|
||
|
}
|
||
|
pre, code {
|
||
|
background-color: #f7f7f7;
|
||
|
border-radius: 3px;
|
||
|
color: #333;
|
||
|
white-space: pre-wrap;
|
||
|
}
|
||
|
pre {
|
||
|
border-radius: 3px;
|
||
|
margin: 5px 0px 10px 0px;
|
||
|
padding: 10px;
|
||
|
}
|
||
|
pre:not([class]) {
|
||
|
background-color: #f7f7f7;
|
||
|
}
|
||
|
code {
|
||
|
font-family: Consolas, Monaco, 'Courier New', monospace;
|
||
|
font-size: 85%;
|
||
|
}
|
||
|
p > code, li > code {
|
||
|
padding: 2px 0px;
|
||
|
}
|
||
|
div.figure {
|
||
|
text-align: center;
|
||
|
}
|
||
|
img {
|
||
|
background-color: #FFFFFF;
|
||
|
padding: 2px;
|
||
|
border: 1px solid #DDDDDD;
|
||
|
border-radius: 3px;
|
||
|
border: 1px solid #CCCCCC;
|
||
|
margin: 0 5px;
|
||
|
}
|
||
|
h1 {
|
||
|
margin-top: 0;
|
||
|
font-size: 35px;
|
||
|
line-height: 40px;
|
||
|
}
|
||
|
h2 {
|
||
|
border-bottom: 4px solid #f7f7f7;
|
||
|
padding-top: 10px;
|
||
|
padding-bottom: 2px;
|
||
|
font-size: 145%;
|
||
|
}
|
||
|
h3 {
|
||
|
border-bottom: 2px solid #f7f7f7;
|
||
|
padding-top: 10px;
|
||
|
font-size: 120%;
|
||
|
}
|
||
|
h4 {
|
||
|
border-bottom: 1px solid #f7f7f7;
|
||
|
margin-left: 8px;
|
||
|
font-size: 105%;
|
||
|
}
|
||
|
h5, h6 {
|
||
|
border-bottom: 1px solid #ccc;
|
||
|
font-size: 105%;
|
||
|
}
|
||
|
a {
|
||
|
color: #0033dd;
|
||
|
text-decoration: none;
|
||
|
}
|
||
|
a:hover {
|
||
|
color: #6666ff; }
|
||
|
a:visited {
|
||
|
color: #800080; }
|
||
|
a:visited:hover {
|
||
|
color: #BB00BB; }
|
||
|
a[href^="http:"] {
|
||
|
text-decoration: underline; }
|
||
|
a[href^="https:"] {
|
||
|
text-decoration: underline; }
|
||
|
|
||
|
code > span.kw { color: #555; font-weight: bold; }
|
||
|
code > span.dt { color: #902000; }
|
||
|
code > span.dv { color: #40a070; }
|
||
|
code > span.bn { color: #d14; }
|
||
|
code > span.fl { color: #d14; }
|
||
|
code > span.ch { color: #d14; }
|
||
|
code > span.st { color: #d14; }
|
||
|
code > span.co { color: #888888; font-style: italic; }
|
||
|
code > span.ot { color: #007020; }
|
||
|
code > span.al { color: #ff0000; font-weight: bold; }
|
||
|
code > span.fu { color: #900; font-weight: bold; }
|
||
|
code > span.er { color: #a61717; background-color: #e3d2d2; }
|
||
|
</style>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<h1 class="title toc-ignore">Generating isolines and isobands</h1>
|
||
|
<h4 class="author">Claus O. Wilke</h4>
|
||
|
<h4 class="date">2022-12-19</h4>
|
||
|
|
||
|
|
||
|
|
||
|
<p>The isoband package implements fast algorithms for generating
|
||
|
isolines (lines of equal elevation) and isobands (ranges of elevation
|
||
|
delimited by two isolines) from a matrix of elevation data. For both
|
||
|
cases, the package employs the marching squares algorithms as described
|
||
|
on <a href="https://en.wikipedia.org/wiki/Marching_squares">Wikipedia.</a>
|
||
|
Marching squares algorithms break down the elevation matrix into blocks
|
||
|
of 2x2 elevation values. For each block, they then determine the
|
||
|
appropriate isolines/isobands from a lookup table of all possible
|
||
|
arrangements of isolines or isobands within a 2x2 block. There are 16
|
||
|
distinct possibilities for isolines and 81 for isobands. The
|
||
|
implementation in the isoband package goes beyond the algorithm
|
||
|
described on Wikipedia in that it merges the isolines or isobands from
|
||
|
separate blocks into extended line traces or polygons. The package is
|
||
|
meant as a low-level package with minimal required dependencies.
|
||
|
Therefore, many of the functions provided may not immediately be useful
|
||
|
to endusers, but they will enable developers of other packages to
|
||
|
integrate isolines and isobands into their feature set.</p>
|
||
|
<p>The two main functions of the package are called
|
||
|
<code>isolines()</code> and <code>isobands()</code>, and they have
|
||
|
similar user interfaces and return values. Both take a vector
|
||
|
<code>x</code> specifying the x values corresponding to the columns of
|
||
|
the elevation matrix, a vector <code>y</code> specifying the y values
|
||
|
corresponding to the rows of the elevation matrix, and an elevation
|
||
|
matrix <code>z</code>. The two functions differ in that
|
||
|
<code>isolines()</code> takes a single argument <code>levels</code>
|
||
|
specifying the elevation levels for which isolines should be calculated,
|
||
|
whereas <code>isobands()</code> takes two arguments,
|
||
|
<code>levels_low</code> and <code>levels_high</code>, specifying the
|
||
|
lower and upper bounds for each isoband. The return value in both cases
|
||
|
is a list of lists. The outer list contains one list element for each
|
||
|
specified isolevel. The inner lists hold line or polygon data in the
|
||
|
form <code>x</code>, <code>y</code>, <code>id</code> as used by
|
||
|
<code>grid::polylineGrob()</code> or <code>grid::pathGrob()</code>. The
|
||
|
format has been chosen for easy drawing of the resulting values via
|
||
|
these two grid functions.</p>
|
||
|
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(isoband)</span>
|
||
|
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(grid)</span>
|
||
|
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a></span>
|
||
|
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a>m <span class="ot"><-</span> <span class="fu">matrix</span>(</span>
|
||
|
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">c</span>(<span class="dv">0</span>, <span class="dv">0</span>, <span class="dv">0</span>, <span class="dv">0</span>, <span class="dv">0</span>,</span>
|
||
|
<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a> <span class="dv">0</span>, <span class="dv">1</span>, <span class="dv">2</span>, <span class="dv">1</span>, <span class="dv">0</span>,</span>
|
||
|
<span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a> <span class="dv">0</span>, <span class="dv">1</span>, <span class="dv">2</span>, <span class="dv">0</span>, <span class="dv">0</span>,</span>
|
||
|
<span id="cb1-8"><a href="#cb1-8" aria-hidden="true" tabindex="-1"></a> <span class="dv">0</span>, <span class="dv">1</span>, <span class="dv">0</span>, <span class="dv">1</span>, <span class="dv">0</span>,</span>
|
||
|
<span id="cb1-9"><a href="#cb1-9" aria-hidden="true" tabindex="-1"></a> <span class="dv">0</span>, <span class="dv">0</span>, <span class="dv">0</span>, <span class="dv">0</span>, <span class="dv">0</span>),</span>
|
||
|
<span id="cb1-10"><a href="#cb1-10" aria-hidden="true" tabindex="-1"></a> <span class="dv">5</span>, <span class="dv">5</span>, <span class="at">byrow =</span> <span class="cn">TRUE</span></span>
|
||
|
<span id="cb1-11"><a href="#cb1-11" aria-hidden="true" tabindex="-1"></a>)</span>
|
||
|
<span id="cb1-12"><a href="#cb1-12" aria-hidden="true" tabindex="-1"></a></span>
|
||
|
<span id="cb1-13"><a href="#cb1-13" aria-hidden="true" tabindex="-1"></a>lines <span class="ot"><-</span> <span class="fu">isolines</span>(<span class="at">x =</span> <span class="dv">1</span><span class="sc">:</span><span class="fu">ncol</span>(m)<span class="sc">/</span><span class="dv">6</span>, <span class="at">y =</span> <span class="fu">nrow</span>(m)<span class="sc">:</span><span class="dv">1</span><span class="sc">/</span><span class="dv">6</span>, <span class="at">z =</span> m, <span class="at">levels =</span> <span class="fl">0.5</span>)</span>
|
||
|
<span id="cb1-14"><a href="#cb1-14" aria-hidden="true" tabindex="-1"></a>lines</span>
|
||
|
<span id="cb1-15"><a href="#cb1-15" aria-hidden="true" tabindex="-1"></a><span class="co">#> $`0.5`</span></span>
|
||
|
<span id="cb1-16"><a href="#cb1-16" aria-hidden="true" tabindex="-1"></a><span class="co">#> $`0.5`$x</span></span>
|
||
|
<span id="cb1-17"><a href="#cb1-17" aria-hidden="true" tabindex="-1"></a><span class="co">#> [1] 0.6666667 0.5833333 0.5000000 0.4166667 0.3333333 0.2500000 0.2500000</span></span>
|
||
|
<span id="cb1-18"><a href="#cb1-18" aria-hidden="true" tabindex="-1"></a><span class="co">#> [8] 0.2500000 0.3333333 0.5000000 0.6666667 0.7500000 0.6666667 0.6250000</span></span>
|
||
|
<span id="cb1-19"><a href="#cb1-19" aria-hidden="true" tabindex="-1"></a><span class="co">#> [15] 0.6666667 0.7500000 0.6666667</span></span>
|
||
|
<span id="cb1-20"><a href="#cb1-20" aria-hidden="true" tabindex="-1"></a><span class="co">#> </span></span>
|
||
|
<span id="cb1-21"><a href="#cb1-21" aria-hidden="true" tabindex="-1"></a><span class="co">#> $`0.5`$y</span></span>
|
||
|
<span id="cb1-22"><a href="#cb1-22" aria-hidden="true" tabindex="-1"></a><span class="co">#> [1] 0.2500000 0.3333333 0.3750000 0.3333333 0.2500000 0.3333333 0.5000000</span></span>
|
||
|
<span id="cb1-23"><a href="#cb1-23" aria-hidden="true" tabindex="-1"></a><span class="co">#> [8] 0.6666667 0.7500000 0.7916667 0.7500000 0.6666667 0.5833333 0.5000000</span></span>
|
||
|
<span id="cb1-24"><a href="#cb1-24" aria-hidden="true" tabindex="-1"></a><span class="co">#> [15] 0.4166667 0.3333333 0.2500000</span></span>
|
||
|
<span id="cb1-25"><a href="#cb1-25" aria-hidden="true" tabindex="-1"></a><span class="co">#> </span></span>
|
||
|
<span id="cb1-26"><a href="#cb1-26" aria-hidden="true" tabindex="-1"></a><span class="co">#> $`0.5`$id</span></span>
|
||
|
<span id="cb1-27"><a href="#cb1-27" aria-hidden="true" tabindex="-1"></a><span class="co">#> [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1</span></span>
|
||
|
<span id="cb1-28"><a href="#cb1-28" aria-hidden="true" tabindex="-1"></a><span class="co">#> </span></span>
|
||
|
<span id="cb1-29"><a href="#cb1-29" aria-hidden="true" tabindex="-1"></a><span class="co">#> </span></span>
|
||
|
<span id="cb1-30"><a href="#cb1-30" aria-hidden="true" tabindex="-1"></a><span class="co">#> attr(,"class")</span></span>
|
||
|
<span id="cb1-31"><a href="#cb1-31" aria-hidden="true" tabindex="-1"></a><span class="co">#> [1] "isolines" "iso"</span></span>
|
||
|
<span id="cb1-32"><a href="#cb1-32" aria-hidden="true" tabindex="-1"></a><span class="fu">grid.newpage</span>()</span>
|
||
|
<span id="cb1-33"><a href="#cb1-33" aria-hidden="true" tabindex="-1"></a><span class="fu">grid.draw</span>(<span class="fu">polylineGrob</span>(lines[[<span class="dv">1</span>]]<span class="sc">$</span>x, lines[[<span class="dv">1</span>]]<span class="sc">$</span>y, lines[[<span class="dv">1</span>]]<span class="sc">$</span>id))</span></code></pre></div>
|
||
|
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASAAAAEgCAYAAAAUg66AAAAEDmlDQ1BrQ0dDb2xvclNwYWNlR2VuZXJpY1JHQgAAOI2NVV1oHFUUPpu5syskzoPUpqaSDv41lLRsUtGE2uj+ZbNt3CyTbLRBkMns3Z1pJjPj/KRpKT4UQRDBqOCT4P9bwSchaqvtiy2itFCiBIMo+ND6R6HSFwnruTOzu5O4a73L3PnmnO9+595z7t4LkLgsW5beJQIsGq4t5dPis8fmxMQ6dMF90A190C0rjpUqlSYBG+PCv9rt7yDG3tf2t/f/Z+uuUEcBiN2F2Kw4yiLiZQD+FcWyXYAEQfvICddi+AnEO2ycIOISw7UAVxieD/Cyz5mRMohfRSwoqoz+xNuIB+cj9loEB3Pw2448NaitKSLLRck2q5pOI9O9g/t/tkXda8Tbg0+PszB9F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SBASEz7hNEkDjeqvWsIDwGb85Amh8cxUbFBA+OU0RQDnuqjYkIHzymiGA8uxVbkBA+OQ2QQDl+queKCB8EvH/V1oA5ffACpIE3n///e6rr77y774l+fdlBVAivtJ5Ag8ePFgUv337dt4iVBZA9sBhCnz88cdd/+olV8AdUK6/6gkC7n4S0AslBVABxvB8Bdz9tNNbAdROL6xkBAF3PyMgb1FCAG2B5dTpC7j7aauHAqitflhNoIC7n0DcHacWQDvCuWx6Au5+2uuZAGqvJ1YUIODuJwC1wpQCqAKiKdoXcPfTZo8EUJt9saqKAu5+KmJWnkoAVQY1XXsC7n7a68lyRQJoKeHtLAXc/bTd
|
||
|
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a></span>
|
||
|
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a>bands <span class="ot"><-</span> <span class="fu">isobands</span>(<span class="at">x =</span> <span class="dv">1</span><span class="sc">:</span><span class="fu">ncol</span>(m)<span class="sc">/</span><span class="dv">6</span>, <span class="at">y =</span> <span class="fu">nrow</span>(m)<span class="sc">:</span><span class="dv">1</span><span class="sc">/</span><span class="dv">6</span>, <span class="at">z =</span> m, <span class="at">levels_low =</span> <span class="fl">0.5</span>, <span class="at">levels_high =</span> <span class="fl">1.5</span>)</span>
|
||
|
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a>bands</span>
|
||
|
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a><span class="co">#> $`0.5:1.5`</span></span>
|
||
|
<span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a><span class="co">#> $`0.5:1.5`$x</span></span>
|
||
|
<span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a><span class="co">#> [1] 0.4166667 0.3333333 0.2500000 0.2500000 0.2500000 0.3333333 0.5000000</span></span>
|
||
|
<span id="cb2-7"><a href="#cb2-7" aria-hidden="true" tabindex="-1"></a><span class="co">#> [8] 0.6666667 0.7500000 0.6666667 0.6250000 0.6666667 0.7500000 0.6666667</span></span>
|
||
|
<span id="cb2-8"><a href="#cb2-8" aria-hidden="true" tabindex="-1"></a><span class="co">#> [15] 0.5833333 0.5000000 0.5000000 0.5416667 0.5833333 0.5000000 0.4166667</span></span>
|
||
|
<span id="cb2-9"><a href="#cb2-9" aria-hidden="true" tabindex="-1"></a><span class="co">#> [22] 0.4166667</span></span>
|
||
|
<span id="cb2-10"><a href="#cb2-10" aria-hidden="true" tabindex="-1"></a><span class="co">#> </span></span>
|
||
|
<span id="cb2-11"><a href="#cb2-11" aria-hidden="true" tabindex="-1"></a><span class="co">#> $`0.5:1.5`$y</span></span>
|
||
|
<span id="cb2-12"><a href="#cb2-12" aria-hidden="true" tabindex="-1"></a><span class="co">#> [1] 0.3333333 0.2500000 0.3333333 0.5000000 0.6666667 0.7500000 0.7916667</span></span>
|
||
|
<span id="cb2-13"><a href="#cb2-13" aria-hidden="true" tabindex="-1"></a><span class="co">#> [8] 0.7500000 0.6666667 0.5833333 0.5000000 0.4166667 0.3333333 0.2500000</span></span>
|
||
|
<span id="cb2-14"><a href="#cb2-14" aria-hidden="true" tabindex="-1"></a><span class="co">#> [15] 0.3333333 0.3750000 0.4583333 0.5000000 0.6666667 0.7083333 0.6666667</span></span>
|
||
|
<span id="cb2-15"><a href="#cb2-15" aria-hidden="true" tabindex="-1"></a><span class="co">#> [22] 0.5000000</span></span>
|
||
|
<span id="cb2-16"><a href="#cb2-16" aria-hidden="true" tabindex="-1"></a><span class="co">#> </span></span>
|
||
|
<span id="cb2-17"><a href="#cb2-17" aria-hidden="true" tabindex="-1"></a><span class="co">#> $`0.5:1.5`$id</span></span>
|
||
|
<span id="cb2-18"><a href="#cb2-18" aria-hidden="true" tabindex="-1"></a><span class="co">#> [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2</span></span>
|
||
|
<span id="cb2-19"><a href="#cb2-19" aria-hidden="true" tabindex="-1"></a><span class="co">#> </span></span>
|
||
|
<span id="cb2-20"><a href="#cb2-20" aria-hidden="true" tabindex="-1"></a><span class="co">#> </span></span>
|
||
|
<span id="cb2-21"><a href="#cb2-21" aria-hidden="true" tabindex="-1"></a><span class="co">#> attr(,"class")</span></span>
|
||
|
<span id="cb2-22"><a href="#cb2-22" aria-hidden="true" tabindex="-1"></a><span class="co">#> [1] "isobands" "iso"</span></span>
|
||
|
<span id="cb2-23"><a href="#cb2-23" aria-hidden="true" tabindex="-1"></a><span class="fu">grid.newpage</span>()</span>
|
||
|
<span id="cb2-24"><a href="#cb2-24" aria-hidden="true" tabindex="-1"></a><span class="fu">grid.draw</span>(<span class="fu">pathGrob</span>(bands[[<span class="dv">1</span>]]<span class="sc">$</span>x, bands[[<span class="dv">1</span>]]<span class="sc">$</span>y, bands[[<span class="dv">1</span>]]<span class="sc">$</span>id, <span class="at">gp =</span> <span class="fu">gpar</span>(<span class="at">fill =</span> <span class="st">"cornsilk"</span>)))</span></code></pre></div>
|
||
|
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASAAAAEgCAYAAAAUg66AAAAEDmlDQ1BrQ0dDb2xvclNwYWNlR2VuZXJpY1JHQgAAOI2NVV1oHFUUPpu5syskzoPUpqaSDv41lLRsUtGE2uj+ZbNt3CyTbLRBkMns3Z1pJjPj/KRpKT4UQRDBqOCT4P9bwSchaqvtiy2itFCiBIMo+ND6R6HSFwnruTOzu5O4a73L3PnmnO9+595z7t4LkLgsW5beJQIsGq4t5dPis8fmxMQ6dMF90A190C0rjpUqlSYBG+PCv9rt7yDG3tf2t/f/Z+uuUEcBiN2F2Kw4yiLiZQD+FcWyXYAEQfvICddi+AnEO2ycIOISw7UAVxieD/Cyz5mRMohfRSwoqoz+xNuIB+cj9loEB3Pw2448NaitKSLLRck2q5pOI9O9g/t/tkXda8Tbg0+PszB9FN8DuPaXKnKW4YcQn1Xk3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ij65dgIJjUaMD6MO4NRqtcz3v3d3sl+ds3/pN6bd+Kw599obGx+bGPByo9k1PT1tzp573bzz7vvmd4fTFFA0MCPvCAKKvEB1u1d8XqtuHI3jr7zy82aqeatG6lo5mf2Mjg8Bjc6KlgEJnD9/vpOtndw3xiIft0GCgNx40ToQAfvn72Ri3xqLfNwHBwJyZ8YRAQi0Tr/YEdDNATLJpEA+1TgioGrcOMozgdOnW8ms/yCf6oMBAVVnx5GeCKS0/oN86g0CBFSPH0d7IJDK+g/yqV98BFSfIRGECaSw/oN8ZIqOgGQ4EkWQQOzrP8hHrtgISI4lkQQIxL7+
|
||
|
<p>A convenience function <code>plot_iso()</code> can be used to inspect
|
||
|
a single isoband and corresponding isolines for an elevation matrix.
|
||
|
This function is mostly meant for debugging and illustration purposes.
|
||
|
It draws a grid of matrix points colored by whether each point is below,
|
||
|
within, or above the isoband, as well as the isoband itself and the
|
||
|
enclosing isolines.</p>
|
||
|
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="fu">plot_iso</span>(m, <span class="fl">0.5</span>, <span class="fl">1.5</span>)</span></code></pre></div>
|
||
|
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASAAAAEgCAYAAAAUg66AAAAEDmlDQ1BrQ0dDb2xvclNwYWNlR2VuZXJpY1JHQgAAOI2NVV1oHFUUPpu5syskzoPUpqaSDv41lLRsUtGE2uj+ZbNt3CyTbLRBkMns3Z1pJjPj/KRpKT4UQRDBqOCT4P9bwSchaqvtiy2itFCiBIMo+ND6R6HSFwnruTOzu5O4a73L3PnmnO9+595z7t4LkLgsW5beJQIsGq4t5dPis8fmxMQ6dMF90A190C0rjpUqlSYBG+PCv9rt7yDG3tf2t/f/Z+uuUEcBiN2F2Kw4yiLiZQD+FcWyXYAEQfvICddi+AnEO2ycIOISw7UAVxieD/Cyz5mRMohfRSwoqoz+xNuIB+cj9loE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SGqKQDhqaFmrbDAhlY0h1a5d21onbfOzgYDCGMD8/Hzi/2xd9ucpfL8tXt6XN8NoGocaQEAWkhxD+ue/sui22271iiFBSOENBAQUIr+MjAx6+qkn6NChI14/TwHhhAjUBoeVlJR4xZC+/W6TdNbZ2dnUrl07G/TAeqcIAYUwJiyf4cOG0oqlb9IdXdsF/XmKEKrGITYiwEL6bt2/acy452hZ2ufUW/xRNiR1BCAgdbxIls/ni9+gnj/9IJfKKlDcYQQ2btpOQx58ij7/Yrl4edbLYb3Ttzv4TWgVfCEfFbBcVLT7PZ1p+WcLaMTwYeLP1Ka7qOfhdxUCUsgQ8lEIyqXFenTvQl8smQ8JqRx/CEgBMMhHASQUIUhI/SSAgCpgBvlUAAi7
|
||
|
<p>The isoband package handles <code>NA</code> values in the matrix by
|
||
|
simply ignoring the respective grid points.</p>
|
||
|
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a>m <span class="ot"><-</span> <span class="fu">matrix</span>(</span>
|
||
|
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">c</span>(<span class="cn">NA</span>, <span class="cn">NA</span>, <span class="cn">NA</span>, <span class="dv">0</span>, <span class="dv">0</span>, <span class="dv">0</span>,</span>
|
||
|
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a> <span class="cn">NA</span>, <span class="cn">NA</span>, <span class="cn">NA</span>, <span class="dv">1</span>, <span class="dv">1</span>, <span class="dv">0</span>,</span>
|
||
|
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a> <span class="dv">0</span>, <span class="dv">0</span>, <span class="dv">1</span>, <span class="dv">1</span>, <span class="dv">1</span>, <span class="dv">0</span>,</span>
|
||
|
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a> <span class="dv">0</span>, <span class="dv">1</span>, <span class="dv">1</span>, <span class="dv">0</span>, <span class="dv">0</span>, <span class="dv">0</span>,</span>
|
||
|
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a> <span class="dv">0</span>, <span class="dv">0</span>, <span class="dv">0</span>, <span class="dv">1</span>, <span class="dv">0</span>, <span class="dv">0</span>,</span>
|
||
|
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a> <span class="dv">0</span>, <span class="dv">0</span>, <span class="dv">0</span>, <span class="dv">0</span>, <span class="dv">0</span>, <span class="dv">0</span>),</span>
|
||
|
<span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a> <span class="dv">6</span>, <span class="dv">6</span>, <span class="at">byrow =</span> <span class="cn">TRUE</span></span>
|
||
|
<span id="cb4-9"><a href="#cb4-9" aria-hidden="true" tabindex="-1"></a>)</span>
|
||
|
<span id="cb4-10"><a href="#cb4-10" aria-hidden="true" tabindex="-1"></a><span class="fu">plot_iso</span>(m, <span class="fl">0.5</span>, <span class="fl">1.5</span>)</span></code></pre></div>
|
||
|
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASAAAAEgCAYAAAAUg66AAAAEDmlDQ1BrQ0dDb2xvclNwYWNlR2VuZXJpY1JHQgAAOI2NVV1oHFUUPpu5syskzoPUpqaSDv41lLRsUtGE2uj+ZbNt3CyTbLRBkMns3Z1pJjPj/KRpKT4UQRDBqOCT4P9bwSchaqvtiy2itFCiBIMo+ND6R6HSFwnruTOzu5O4a73L3PnmnO9+595z7t4LkLgsW5beJQIsGq4t5dPis8fmxMQ6dMF90A190C0rjpUqlSYBG+PCv9rt7yDG3tf2t/f/Z+uuUEcBiN2F2Kw4yiLiZQD+FcWyXYAEQfvICddi+AnEO2ycIOISw7UAVxieD/Cyz5mRMohfRSwoqoz+xNuIB+cj9loEB3Pw2448NaitKSLLRck2q5pOI9O9g/t/tkXda8Tbg0+PszB9FN8DuPaXKnKW4YcQn1Xk3HSIry5ps8UQ/2W5aQn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XacaMGcQPJczIyNDlwyWnv/kx3UzP9H6QxHuPHDtHHy3/VssnnzIys3X5cLgz5qzWcxQRelRUaf1pG+fPnaARw4f59C8rzpkzh2bOnEkHDhygNWvW0JUrV+jUqVP6PjO5QEBmaKGs3wjs2rXL62UEP0Mr6chZv8UhqqFv4w94rerq1TRK+eWq18+s7PSXhObOnUubN2/WLiWj9TD5AYvJycn06quv0s2bNw2HDgEZRoWC/iSQlpbm9QzOz9BKu5nhz1CEtHXjRrrXekJDQ7QvrNgZHUvo6y8XUFLiQTp8+LDXdku6MzU1VV/3KVhPZGQk8b/r
|
||
|
<p>Isobands can contain holes, as shown above, and they can also consist
|
||
|
of multiple disconnected pieces.</p>
|
||
|
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a>m <span class="ot"><-</span> <span class="fu">matrix</span>(</span>
|
||
|
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">c</span>(<span class="dv">0</span>, <span class="dv">0</span>, <span class="dv">1</span>, <span class="dv">1</span>,</span>
|
||
|
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a> <span class="dv">0</span>, <span class="dv">1</span>, <span class="dv">1</span>, <span class="dv">1</span>,</span>
|
||
|
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a> <span class="dv">1</span>, <span class="dv">1</span>, <span class="dv">0</span>, <span class="dv">0</span>,</span>
|
||
|
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a> <span class="dv">0</span>, <span class="dv">0</span>, <span class="fl">0.8</span>, <span class="dv">0</span>),</span>
|
||
|
<span id="cb5-6"><a href="#cb5-6" aria-hidden="true" tabindex="-1"></a> <span class="dv">4</span>, <span class="dv">4</span>, <span class="at">byrow =</span> <span class="cn">TRUE</span></span>
|
||
|
<span id="cb5-7"><a href="#cb5-7" aria-hidden="true" tabindex="-1"></a>)</span>
|
||
|
<span id="cb5-8"><a href="#cb5-8" aria-hidden="true" tabindex="-1"></a><span class="fu">plot_iso</span>(m, <span class="fl">0.5</span>, <span class="fl">1.5</span>)</span></code></pre></div>
|
||
|
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASAAAAEgCAYAAAAUg66AAAAEDmlDQ1BrQ0dDb2xvclNwYWNlR2VuZXJpY1JHQgAAOI2NVV1oHFUUPpu5syskzoPUpqaSDv41lLRsUtGE2uj+ZbNt3CyTbLRBkMns3Z1pJjPj/KRpKT4UQRDBqOCT4P9bwSchaqvtiy2itFCiBIMo+ND6R6HSFwnruTOzu5O4a73L3PnmnO9+595z7t4LkLgsW5beJQIsGq4t5dPis8fmxMQ6dMF90A190C0rjpUqlSYBG+PCv9rt7yDG3tf2t/f/Z+uuUEcBiN2F2Kw4yiLiZQD+FcWyXYAEQfvICddi+AnEO2ycIOISw7UAVxieD/Cyz5mRMohfRSwoqoz+xNuIB+cj9loEB3Pw2448NaitKSLLRck2q5pOI9O9g/t/tkXda8Tbg0+PszB9FN8DuPaXKnKW4YcQn1Xk3HSIry5ps8UQ/2W5aQnxIwBdu7yFcgrxPsRjVXu8HOh0qao30cArp9SZZxDfg3h1wTzKxu5E/LUxX5wKdX5SnAzmDx4A4OIqLbB69yMesE1pKojLjVdoNsfyiPi45hZmAn3uLWdpOtfQOaVmikEs7ovj8hFWpz7EV6mel0L9Xy23FMYlPYZenAx0yDB1/PX6dledmQjikjkXCxqMJS9WtfFCyH9XtSekEF+2dH+P4tzITduTygGfv58a5VCTH5PtXD7EFZiNyUDBhHnsFTBgE0SQIA9pfFtgo6cKGuhooeilaKH41eDs38Ip+f4At1Rq/sjr6NEwQqb/I/DQqsLvaFUjvAx+eWirddAJZnAj1DFJL0mSg/gcIpPkMBkhoyCSJ8lTZIxk0TpKDjXHliJzZPO50dR5ASNSnzeLvIvod0HG/mdkmOC0z8VKnzcQ2M/Yz2vKldduXjp9bleLu0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BTwAjqdPvJxmijzNUQAATVEJ8POIZ8MK7gGy0VAGhRBhxSQjw5VyLwcEFDm1TxhxcgnAQkNHhFAQB6B1jUM8tG1MpmRFwLKjDonXSXySYqFRg8JICAPYesUCvnoVI3MzQUBZWDtkU8GFl3TJSMgTQvjVlrIxy2yzGuHAAKyQy2gY5BPQAsX4rQRUIiLW3dpyKcuDd7rQgAB6VIJF/NAPi7CZeq0CCCgtPDpPxj56F+jTM4QAYW4+sgnxMUNydIQUEgKWX8ZyKc+ET7rSAAB6ViVNHNCPmkCZLhnBBCQZ6i9CYR8vOFMFGcIICBnOGoxC/LRogwkYYEAArIAS+euyEfn6pBbKgIIKBWZALUjnwAVi1TjCCCgOBzB+4B8glczMv6eAAL6nkXg3iGfwJWMhOsRQED1gATlI/IJSqXIsyECCKghOpqeQz6aFoa0LBNAQJaR+TsA+fjLn+jOEkBAzvJ0dTbk4ypeJveBAALyAbqdkMjHDjXG6E4AAeleoWh+yCcARSJFWwQQkC1s3g1CPt6xJpL3BBCQ98xNR0Q+plHRMaAEEJCmhUM+mhaGtBwlgIAcxenMZKWlpXJtwTUysH9Pee6ZORKJRJyZmFkgoBkBBKRZQZR82rZpg3w0qwvpuEMgci76cmdqZrVK4OTJk3LRoIHyr7+6Te6feofV4fSHgD8EsvJFsrvZio2AbGFzfpDa8xkzepT07dNFXnjuEecDMCME3CKQhoB4BHOrKBbmrSuf55c+bGEkXSEQbAIIyOf61ZcPG84+F4TwnhJAQJ7ijg+GfOJ58CnzCCAgn2qOfHwCT1itCCAgH8qBfHyATkgtCSAgj8uCfDwGTjitCSAgD8uDfDyETahAEEBAHpUJ+XgEmjCBIoCAPCgX8vEAMiECSQABuVw25OMyYKYPNAEE5GL5kI+LcJk6FAQQkEtlRD4ugWXaUBFAQC6UE/m4AJUpQ0kAATlcVuTj
|
||
|
<div id="performance" class="section level1">
|
||
|
<h1>Performance</h1>
|
||
|
<p>The code is written in C++ and performance is generally good.
|
||
|
Isolining is about as fast as <code>grDevices::contourLines()</code>,
|
||
|
isobanding is approximately 2.5 times slower.</p>
|
||
|
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="co"># contouring with contourLines() from grDevices</span></span>
|
||
|
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a>fn_contourLines <span class="ot"><-</span> <span class="cf">function</span>() {</span>
|
||
|
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a> grDevices<span class="sc">::</span><span class="fu">contourLines</span>(<span class="dv">1</span><span class="sc">:</span><span class="fu">ncol</span>(volcano), <span class="dv">1</span><span class="sc">:</span><span class="fu">nrow</span>(volcano), volcano, <span class="at">levels =</span> <span class="dv">10</span><span class="sc">*</span>(<span class="dv">10</span><span class="sc">:</span><span class="dv">18</span>))</span>
|
||
|
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a>}</span>
|
||
|
<span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a></span>
|
||
|
<span id="cb6-6"><a href="#cb6-6" aria-hidden="true" tabindex="-1"></a><span class="co"># contouring with isolines()</span></span>
|
||
|
<span id="cb6-7"><a href="#cb6-7" aria-hidden="true" tabindex="-1"></a>fn_isolines <span class="ot"><-</span> <span class="cf">function</span>() {</span>
|
||
|
<span id="cb6-8"><a href="#cb6-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">isolines</span>(<span class="dv">1</span><span class="sc">:</span><span class="fu">ncol</span>(volcano), <span class="dv">1</span><span class="sc">:</span><span class="fu">nrow</span>(volcano), volcano, <span class="dv">10</span><span class="sc">*</span>(<span class="dv">10</span><span class="sc">:</span><span class="dv">18</span>))</span>
|
||
|
<span id="cb6-9"><a href="#cb6-9" aria-hidden="true" tabindex="-1"></a>}</span>
|
||
|
<span id="cb6-10"><a href="#cb6-10" aria-hidden="true" tabindex="-1"></a></span>
|
||
|
<span id="cb6-11"><a href="#cb6-11" aria-hidden="true" tabindex="-1"></a><span class="co"># contouring with isobands()</span></span>
|
||
|
<span id="cb6-12"><a href="#cb6-12" aria-hidden="true" tabindex="-1"></a>fn_isobands <span class="ot"><-</span> <span class="cf">function</span>() {</span>
|
||
|
<span id="cb6-13"><a href="#cb6-13" aria-hidden="true" tabindex="-1"></a> <span class="fu">isobands</span>(<span class="dv">1</span><span class="sc">:</span><span class="fu">ncol</span>(volcano), <span class="dv">1</span><span class="sc">:</span><span class="fu">nrow</span>(volcano), volcano, <span class="dv">10</span><span class="sc">*</span>(<span class="dv">9</span><span class="sc">:</span><span class="dv">17</span>), <span class="dv">10</span><span class="sc">*</span>(<span class="dv">10</span><span class="sc">:</span><span class="dv">18</span>))</span>
|
||
|
<span id="cb6-14"><a href="#cb6-14" aria-hidden="true" tabindex="-1"></a>}</span>
|
||
|
<span id="cb6-15"><a href="#cb6-15" aria-hidden="true" tabindex="-1"></a></span>
|
||
|
<span id="cb6-16"><a href="#cb6-16" aria-hidden="true" tabindex="-1"></a>microbenchmark<span class="sc">::</span><span class="fu">microbenchmark</span>(<span class="fu">fn_contourLines</span>(), <span class="fu">fn_isolines</span>(), <span class="fu">fn_isobands</span>())</span>
|
||
|
<span id="cb6-17"><a href="#cb6-17" aria-hidden="true" tabindex="-1"></a><span class="co">#> Warning in microbenchmark::microbenchmark(fn_contourLines(), fn_isolines(), :</span></span>
|
||
|
<span id="cb6-18"><a href="#cb6-18" aria-hidden="true" tabindex="-1"></a><span class="co">#> less accurate nanosecond times to avoid potential integer overflows</span></span>
|
||
|
<span id="cb6-19"><a href="#cb6-19" aria-hidden="true" tabindex="-1"></a><span class="co">#> Unit: microseconds</span></span>
|
||
|
<span id="cb6-20"><a href="#cb6-20" aria-hidden="true" tabindex="-1"></a><span class="co">#> expr min lq mean median uq max</span></span>
|
||
|
<span id="cb6-21"><a href="#cb6-21" aria-hidden="true" tabindex="-1"></a><span class="co">#> fn_contourLines() 822.419 897.982 1036.6727 963.3565 995.070 5253.822</span></span>
|
||
|
<span id="cb6-22"><a href="#cb6-22" aria-hidden="true" tabindex="-1"></a><span class="co">#> fn_isolines() 566.948 587.653 616.8585 601.2445 614.549 1795.964</span></span>
|
||
|
<span id="cb6-23"><a href="#cb6-23" aria-hidden="true" tabindex="-1"></a><span class="co">#> fn_isobands() 1327.867 1375.693 1778.1007 1399.7400 1421.593 36578.314</span></span>
|
||
|
<span id="cb6-24"><a href="#cb6-24" aria-hidden="true" tabindex="-1"></a><span class="co">#> neval cld</span></span>
|
||
|
<span id="cb6-25"><a href="#cb6-25" aria-hidden="true" tabindex="-1"></a><span class="co">#> 100 a </span></span>
|
||
|
<span id="cb6-26"><a href="#cb6-26" aria-hidden="true" tabindex="-1"></a><span class="co">#> 100 a </span></span>
|
||
|
<span id="cb6-27"><a href="#cb6-27" aria-hidden="true" tabindex="-1"></a><span class="co">#> 100 b</span></span></code></pre></div>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
<!-- code folding -->
|
||
|
|
||
|
|
||
|
<!-- dynamically load mathjax for compatibility with self-contained -->
|
||
|
<script>
|
||
|
(function () {
|
||
|
var script = document.createElement("script");
|
||
|
script.type = "text/javascript";
|
||
|
script.src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
|
||
|
document.getElementsByTagName("head")[0].appendChild(script);
|
||
|
})();
|
||
|
</script>
|
||
|
|
||
|
</body>
|
||
|
</html>
|