diff --git a/Lesson5_rmd.Rmd b/Lesson5_rmd.Rmd index 3c4adc2..f289453 100644 --- a/Lesson5_rmd.Rmd +++ b/Lesson5_rmd.Rmd @@ -5,6 +5,13 @@ author: | | | Your affiliation here output: + html_document: # html options + highlight: tango + code_folding: show + toc: yes + toc_depth: 4 + number_sections: no + toc_float: yes pdf_document: # pdf options highlight: tango template: null @@ -16,13 +23,6 @@ output: fig_caption: true df_print: tibble latex_engine: xelatex #pdflatex # lualatex - html_document: # html options - highlight: tango - code_folding: show - toc: yes - toc_depth: 4 - number_sections: no - toc_float: yes word_document: # ms word options highlight: tango keep_md: yes @@ -48,7 +48,7 @@ classoption: portrait MathJax.Hub.Config({ TeX: { equationNumbers: {autoNumber: "all"} } }); -```{r, set-options, echo = F, cache = T} +```{r, set-options, echo = F, cache = T,message=F} options(width=100) knitr::opts_chunk$set( eval = TRUE, # run all code @@ -62,7 +62,7 @@ knitr::opts_chunk$set( ### run this once # tinytex::install_tinytex() -packages <- c("DT","htmlwidgets") +packages <- c("dplyr","ggplot2","plotly","DT","htmlwidgets") ppp <- lapply(packages,require,character.only=T) names(ppp) <- packages @@ -132,7 +132,7 @@ $$ ## Embed images/gifs: -. +. \newpage @@ -198,9 +198,8 @@ Table 1. Definitions of model parameters for individual hosts and **parasites**. ### Chapter 2 (with new code) Here's an Easter egg for you ... -```{r,echo=F} -require(ggplot2) -require(plotly) +```{r,echo=F,message=F} +lapply(list(require(plotly),require(ggplot2)),suppressWarnings) nn <- 100 p <- ggplot() + geom_point(aes(rnorm(nn),sample(nn/2,nn,replace=T)),colour = rainbow(nn),size=sample(nn/2,nn,replace=T)/5,alpha=abs(rnorm(nn))) + @@ -214,8 +213,7 @@ ggplotly(p) Here's a new way of creating tables using the `DT` package ```{r,cache=T,warning=F, echo=F} -require(DT) -require(htmlwidgets) +lapply(list(require(DT),require(htmlwidgets)),suppressWarnings) caption <- "Table 1. The 'mtcars' dataset presented in a datatable. Try editing the columns and cells." datatable(mtcars, rownames = T, diff --git a/Lesson5_rmd.html b/Lesson5_rmd.html deleted file mode 100644 index 95ed31f..0000000 --- a/Lesson5_rmd.html +++ /dev/null @@ -1,792 +0,0 @@ - - - - -
- - - - - - - - - -Date: 2019-10-22
-R version: 3.5.0
-*Corresponding author: your email here
This document showcases how to create and use RMarkdown
documents.
You can write in bold and italicised text (in two different ways).
-You can write in-line code
if you want to differentiate between when you are typing normally or highlighting model parameters
, for example.
Equations like this \(t' = \gamma(t - vx/c^{2})\), to appear within text lines.
-Create links to your website.
-Make footnotes1.
-Insert line breaks
between text like this
Insert a horizontal line break using five asterisks (‘*****’)
-(There is also a page break here. Best seen in PDF. Check the raw Rmd file to see the code)
-The raw Rmd file also has the code for inserting user comments,
- -Accordingly, we write the eigenfunction of a spinless particle as the superposition of plane wave states of momentum (\(\pi\)) and energy (\(Ej\)) having amplitudes \(a(\pi,Ej)\) (from2)
-\[ -\phi n(r,t) = - \sum_{i, j} a(p_{i},E_{j}) - e^{ - \frac{i} - {h} - (p_{i} \cdot r - E_{j}t) -} -\]
-.
Figure 1. Example of a stock plot embedded into a PDF from RMarkdown.
- -require(viridis)
-bm <- 0
-par(las=1,bty="n"); xlim <- c(-5,5);ylim <- c(0,0.5)
-set.seed(12)
-N <- 2000
-rr <- rnorm(N); rr2 <- rnorm(N^2); rr3 <- rnorm(N+0.3)
-rrd <- density(rr);rrd2 <- density(rr2);rrd3 <- density(rr3)
-main <- paste0(N," points but plot better");xlab <- "Points in space"
-if(bm==1){
- layout(matrix(c(rep(1,3),2:4), 2, 3, byrow = TRUE));sc <- 1
- plot(rr,las=1,bty="n",col=adjustcolor(viridis(N),0.5),pch=20,cex=runif(10,1,5),
- main=main,xlab=xlab)
-for(r in list(rrd,rrd2,rrd3)){
- plot(r,xlim=xlim,ylim=ylim,main="")
- polygon(r,col=adjustcolor(viridis(250)[sc],0.5),border=viridis(250)[sc]);sc <- sc+100}
-}else{par(mfrow=c(1,1))
- plot(rr,las=1,bty="n",col=adjustcolor(viridis(N),0.5),pch=20,cex=runif(10,1,5),
- main=main,xlab=xlab)}
Figure 2. Example of a plot with improved graphics and its associated code embedded into a PDF from RMarkdown.
- -Table 1. Definitions of model parameters for individual hosts and parasites. Dimensions and units: -, dimensionless; cm, centimetres; J, Joules; L, length.
-Parameter | -Definition | -Dimension (unit) |
-
---|---|---|
L | -structural length | -cm | -
ee | -scaled reserve density | -J (cm3) | -
D | -host development | -— | -
RH | -energy in reproduction buffer | -J | -
Then you can add whatever you want here like you would normally write in the Rmd
file.
-
Here’s an Easter egg for you …
- - -Here’s a new way of creating tables using the DT
package
R
codeif(pck==1){
- p<-c("rJava", "RNetLogo"); remove.packages(p)
- # then install rJava and RNetLogo from source
- install.packages("rJava", repos = "https://cran.r-project.org/")
- install.packages("RNetLogo", repos = "https://cran.r-project.org/")
-}
shell/bash
echo "Hello Bash!"
-pwd # check working dir
-git init # initialise git
RMatlab
package).b = [4; 9; 2] # Column vector
-A = [ 3 4 5;
- 1 3 1;
- 3 5 9 ]
-x = A \ b # Solve the system Ax = b
<!-- links-->
- <div class="footer">
- <a href="dd_feed.html"
- class="transition fade_in">
- Latest post
- </a>
-
- <a href="dd_contact.html"
- class="transition fade_in">
- Contact
- </a>
-
- <a href="dd_subscribe.html"
- class="transition fade_in">
- Subscribe
- </a>
- </div>
# custom code for the tabs in this file
-.btn {
- border-width: 0 0px 0px 0px;
- font-weight: normal;
- text-transform: ;
-}
-.btn-default {
- color: #f08080;
- background-color: #ffffff;
- border-color: #ffffff;
-}
html
and css
$('.title').css('color', 'red')
x = 'hello, python world!'
-print(x.split(' '))
names(knitr::knit_engines$get())
## [1] "awk" "bash" "coffee" "gawk" "groovy"
-## [6] "haskell" "lein" "mysql" "node" "octave"
-## [11] "perl" "psql" "Rscript" "ruby" "sas"
-## [16] "scala" "sed" "sh" "stata" "zsh"
-## [21] "highlight" "Rcpp" "tikz" "dot" "c"
-## [26] "fortran" "fortran95" "asy" "cat" "asis"
-## [31] "stan" "block" "block2" "js" "css"
-## [36] "sql" "go" "python" "julia" "sass"
-## [41] "scss"
-Here is the footnote you created earlier, automatically formatted↩
Efthimiades, S., Physical meaning and derivation of Schrodinger and Dirac equations, Department of Natural Sciences, Fordham University. doi: d34464566.↩
## Warning: package 'dplyr' was built under R version 3.5.2
Date: 2019-10-22
R version: 3.5.0
@@ -525,7 +529,7 @@
.
.
require(viridis)
## Loading required package: viridis
-## Loading required package: viridisLite
-bm <- 0
-par(las=1,bty="n"); xlim <- c(-5,5);ylim <- c(0,0.5)
+require(viridis)
+bm <- 0
+par(las = 1, bty = "n")
+xlim <- c(-5, 5)
+ylim <- c(0, 0.5)
set.seed(12)
N <- 2000
-rr <- rnorm(N); rr2 <- rnorm(N^2); rr3 <- rnorm(N+0.3)
-rrd <- density(rr);rrd2 <- density(rr2);rrd3 <- density(rr3)
-main <- paste0(N," points but plot better");xlab <- "Points in space"
-if(bm==1){
- layout(matrix(c(rep(1,3),2:4), 2, 3, byrow = TRUE));sc <- 1
- plot(rr,las=1,bty="n",col=adjustcolor(viridis(N),0.5),pch=20,cex=runif(10,1,5),
- main=main,xlab=xlab)
-for(r in list(rrd,rrd2,rrd3)){
- plot(r,xlim=xlim,ylim=ylim,main="")
- polygon(r,col=adjustcolor(viridis(250)[sc],0.5),border=viridis(250)[sc]);sc <- sc+100}
-}else{par(mfrow=c(1,1))
- plot(rr,las=1,bty="n",col=adjustcolor(viridis(N),0.5),pch=20,cex=runif(10,1,5),
- main=main,xlab=xlab)}
+rr <- rnorm(N)
+rr2 <- rnorm(N^2)
+rr3 <- rnorm(N + 0.3)
+rrd <- density(rr)
+rrd2 <- density(rr2)
+rrd3 <- density(rr3)
+main <- paste0(N, " points but plot better")
+xlab <- "Points in space"
+if (bm == 1) {
+ layout(matrix(c(rep(1, 3), 2:4), 2, 3, byrow = TRUE))
+ sc <- 1
+ plot(rr, las = 1, bty = "n", col = adjustcolor(viridis(N), 0.5), pch = 20, cex = runif(10, 1, 5),
+ main = main, xlab = xlab)
+ for (r in list(rrd, rrd2, rrd3)) {
+ plot(r, xlim = xlim, ylim = ylim, main = "")
+ polygon(r, col = adjustcolor(viridis(250)[sc], 0.5), border = viridis(250)[sc])
+ sc <- sc + 100
+ }
+} else {
+ par(mfrow = c(1, 1))
+ plot(rr, las = 1, bty = "n", col = adjustcolor(viridis(N), 0.5), pch = 20, cex = runif(10, 1, 5),
+ main = main, xlab = xlab)
+}
Figure 2. Example of a plot with improved graphics and its associated code embedded into a PDF from RMarkdown.
@@ -606,26 +620,22 @@Here’s an Easter egg for you …
-## Loading required package: ggplot2
-## Warning: package 'ggplot2' was built under R version 3.5.2
-## Loading required package: plotly
-##
-## Attaching package: 'plotly'
-## The following object is masked from 'package:ggplot2':
+## [[1]]
+## [1] TRUE
##
-## last_plot
-## The following object is masked from 'package:stats':
-##
-## filter
-## The following object is masked from 'package:graphics':
-##
-## layout
+## [[2]]
+## [1] TRUE
-
+
Here’s a new way of creating tables using the DT
package
## [[1]]
+## [1] TRUE
+##
+## [[2]]
+## [1] TRUE
R
codeif(pck==1){
- p<-c("rJava", "RNetLogo"); remove.packages(p)
- # then install rJava and RNetLogo from source
- install.packages("rJava", repos = "https://cran.r-project.org/")
- install.packages("RNetLogo", repos = "https://cran.r-project.org/")
+if (pck == 1) {
+ p <- c("rJava", "RNetLogo")
+ remove.packages(p)
+ # then install rJava and RNetLogo from source
+ install.packages("rJava", repos = "https://cran.r-project.org/")
+ install.packages("RNetLogo", repos = "https://cran.r-project.org/")
}
names(knitr::knit_engines$get())
## [1] "awk" "bash" "coffee" "gawk" "groovy"
-## [6] "haskell" "lein" "mysql" "node" "octave"
-## [11] "perl" "psql" "Rscript" "ruby" "sas"
-## [16] "scala" "sed" "sh" "stata" "zsh"
-## [21] "highlight" "Rcpp" "tikz" "dot" "c"
-## [26] "fortran" "fortran95" "asy" "cat" "asis"
-## [31] "stan" "block" "block2" "js" "css"
-## [36] "sql" "go" "python" "julia" "sass"
+## [1] "awk" "bash" "coffee" "gawk" "groovy" "haskell" "lein" "mysql"
+## [9] "node" "octave" "perl" "psql" "Rscript" "ruby" "sas" "scala"
+## [17] "sed" "sh" "stata" "zsh" "highlight" "Rcpp" "tikz" "dot"
+## [25] "c" "fortran" "fortran95" "asy" "cat" "asis" "stan" "block"
+## [33] "block2" "js" "css" "sql" "go" "python" "julia" "sass"
## [41] "scss"
Room 2052
Wayne Rollins Building
Room 2052
Wayne Rollins Building
=p0)&&!(p1>=hi)",["p0","p1"]),g=u("lo===p0",["p0"]),m=u("lo =r)for(n=r;++an&&(n=r)}else for(;++a=r)for(n=r;++an&&(n=r);return n},t.mean=function(t,e){var r,n=t.length,i=n,a=-1,o=0;if(null==e)for(;++a l.length)return r;var i,a=c[n-1];return null!=e&&n>=l.length?i=r.entries():(i=[],r.each(function(e,r){i.push({key:r,values:t(e,n)})})),null!=a?i.sort(function(t,e){return a(t.key,e.key)}):i}(u(t,0,a,o),0)},key:function(t){return l.push(t),s},sortKeys:function(t){return c[l.length-1]=t,s},sortValues:function(e){return t=e,s},rollup:function(t){return e=t,s}}},t.set=c,t.map=r,t.keys=function(t){var e=[];for(var r in t)e.push(r);return e},t.values=function(t){var e=[];for(var r in t)e.push(t[r]);return e},t.entries=function(t){var e=[];for(var r in t)e.push({key:r,value:t[r]});return e},Object.defineProperty(t,"__esModule",{value:!0})}("object"==typeof r&&"undefined"!=typeof e?r:n.d3=n.d3||{})},{}],141:[function(t,e,r){var n;n=this,function(t){"use strict";var e=function(t,e,r){t.prototype=e.prototype=r,r.constructor=t};function r(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function n(){}var i="\\s*([+-]?\\d+)\\s*",a="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",o="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",s=/^#([0-9a-f]{3})$/,l=/^#([0-9a-f]{6})$/,c=new RegExp("^rgb\\("+[i,i,i]+"\\)$"),u=new RegExp("^rgb\\("+[o,o,o]+"\\)$"),h=new RegExp("^rgba\\("+[i,i,i,a]+"\\)$"),f=new RegExp("^rgba\\("+[o,o,o,a]+"\\)$"),p=new RegExp("^hsl\\("+[a,o,o]+"\\)$"),d=new RegExp("^hsla\\("+[a,o,o,a]+"\\)$"),g={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function m(t){var e;return t=(t+"").trim().toLowerCase(),(e=s.exec(t))?new _((e=parseInt(e[1],16))>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):(e=l.exec(t))?v(parseInt(e[1],16)):(e=c.exec(t))?new _(e[1],e[2],e[3],1):(e=u.exec(t))?new _(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=h.exec(t))?y(e[1],e[2],e[3],e[4]):(e=f.exec(t))?y(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=p.exec(t))?w(e[1],e[2]/100,e[3]/100,1):(e=d.exec(t))?w(e[1],e[2]/100,e[3]/100,e[4]):g.hasOwnProperty(t)?v(g[t]):"transparent"===t?new _(NaN,NaN,NaN,0):null}function v(t){return new _(t>>16&255,t>>8&255,255&t,1)}function y(t,e,r,n){return n<=0&&(t=e=r=NaN),new _(t,e,r,n)}function x(t){return t instanceof n||(t=m(t)),t?new _((t=t.rgb()).r,t.g,t.b,t.opacity):new _}function b(t,e,r,n){return 1===arguments.length?x(t):new _(t,e,r,null==n?1:n)}function _(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}function w(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new M(t,e,r,n)}function k(t,e,r,i){return 1===arguments.length?function(t){if(t instanceof M)return new M(t.h,t.s,t.l,t.opacity);if(t instanceof n||(t=m(t)),!t)return new M;if(t instanceof M)return t;var e=(t=t.rgb()).r/255,r=t.g/255,i=t.b/255,a=Math.min(e,r,i),o=Math.max(e,r,i),s=NaN,l=o-a,c=(o+a)/2;return l?(s=e===o?(r-i)/l+6*(r0&&c<1?0:s,new M(s,l,c,t.opacity)}(t):new M(t,e,r,null==i?1:i)}function M(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}function A(t,e,r){return 255*(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)}e(n,m,{displayable:function(){return this.rgb().displayable()},toString:function(){return this.rgb()+""}}),e(_,b,r(n,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new _(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new _(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},toString:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}})),e(M,k,r(n,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new M(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new M(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new _(A(t>=240?t-240:t+120,i,n),A(t,i,n),A(t<120?t+240:t-120,i,n),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var T=Math.PI/180,S=180/Math.PI,E=.95047,C=1,L=1.08883,z=4/29,P=6/29,I=3*P*P,O=P*P*P;function D(t){if(t instanceof B)return new B(t.l,t.a,t.b,t.opacity);if(t instanceof q){var e=t.h*T;return new B(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}t instanceof _||(t=x(t));var r=V(t.r),n=V(t.g),i=V(t.b),a=F((.4124564*r+.3575761*n+.1804375*i)/E),o=F((.2126729*r+.7151522*n+.072175*i)/C);return new B(116*o-16,500*(a-o),200*(o-F((.0193339*r+.119192*n+.9503041*i)/L)),t.opacity)}function R(t,e,r,n){return 1===arguments.length?D(t):new B(t,e,r,null==n?1:n)}function B(t,e,r,n){this.l=+t,this.a=+e,this.b=+r,this.opacity=+n}function F(t){return t>O?Math.pow(t,1/3):t/I+z}function N(t){return t>P?t*t*t:I*(t-z)}function j(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function V(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function U(t,e,r,n){return 1===arguments.length?function(t){if(t instanceof q)return new q(t.h,t.c,t.l,t.opacity);t instanceof B||(t=D(t));var e=Math.atan2(t.b,t.a)*S;return new q(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new q(t,e,r,null==n?1:n)}function q(t,e,r,n){this.h=+t,this.c=+e,this.l=+r,this.opacity=+n}e(B,R,r(n,{brighter:function(t){return new B(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new B(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,r=isNaN(this.b)?t:t-this.b/200;return t=C*N(t),new _(j(3.2404542*(e=E*N(e))-1.5371385*t-.4985314*(r=L*N(r))),j(-.969266*e+1.8760108*t+.041556*r),j(.0556434*e-.2040259*t+1.0572252*r),this.opacity)}})),e(q,U,r(n,{brighter:function(t){return new q(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new q(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return D(this).rgb()}}));var H=-.14861,G=1.78277,W=-.29227,Y=-.90649,X=1.97294,Z=X*Y,$=X*G,J=G*W-Y*H;function K(t,e,r,n){return 1===arguments.length?function(t){if(t instanceof Q)return new Q(t.h,t.s,t.l,t.opacity);t instanceof _||(t=x(t));var e=t.r/255,r=t.g/255,n=t.b/255,i=(J*n+Z*e-$*r)/(J+Z-$),a=n-i,o=(X*(r-i)-W*a)/Y,s=Math.sqrt(o*o+a*a)/(X*i*(1-i)),l=s?Math.atan2(o,a)*S-120:NaN;return new Q(l<0?l+360:l,s,i,t.opacity)}(t):new Q(t,e,r,null==n?1:n)}function Q(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}e(Q,K,r(n,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Q(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Q(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*T,e=+this.l,r=isNaN(this.s)?0:this.s*e*(1-e),n=Math.cos(t),i=Math.sin(t);return new _(255*(e+r*(H*n+G*i)),255*(e+r*(W*n+Y*i)),255*(e+r*(X*n)),this.opacity)}})),t.color=m,t.rgb=b,t.hsl=k,t.lab=R,t.hcl=U,t.cubehelix=K,Object.defineProperty(t,"__esModule",{value:!0})}("object"==typeof r&&"undefined"!=typeof e?r:n.d3=n.d3||{})},{}],142:[function(t,e,r){var n;n=this,function(t){"use strict";var e={value:function(){}};function r(){for(var t,e=0,r=arguments.length,i={};e =i.length)return e;var n=[],o=a[r++];return e.forEach(function(e,i){n.push({key:e,values:t(i,r)})}),o?n.sort(function(t,e){return o(t.key,e.key)}):n}(o(t.map,e,0),0)},n.key=function(t){return i.push(t),n},n.sortKeys=function(t){return a[i.length-1]=t,n},n.sortValues=function(t){return e=t,n},n.rollup=function(t){return r=t,n},n},t.set=function(t){var e=new L;if(t)for(var r=0,n=t.length;r 360?t-=360:t<0&&(t+=360),t<60?n+(i-n)*t/60:t<180?i:t<240?n+(i-n)*(240-t)/60:n}(t))}return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,n=2*(r=r<0?0:r>1?1:r)-(i=r<=.5?r*(1+e):r+e-r*e),new ae(a(t+120),a(t),a(t-120))}function Gt(e,r,n){return this instanceof Gt?(this.h=+e,this.c=+r,void(this.l=+n)):arguments.length<2?e instanceof Gt?new Gt(e.h,e.c,e.l):ee(e instanceof Xt?e.l:(e=fe((e=t.rgb(e)).r,e.g,e.b)).l,e.a,e.b):new Gt(e,r,n)}qt.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new Ut(this.h,this.s,this.l/t)},qt.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new Ut(this.h,this.s,t*this.l)},qt.rgb=function(){return Ht(this.h,this.s,this.l)},t.hcl=Gt;var Wt=Gt.prototype=new Vt;function Yt(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new Xt(r,Math.cos(t*=Ct)*e,Math.sin(t)*e)}function Xt(t,e,r){return this instanceof Xt?(this.l=+t,this.a=+e,void(this.b=+r)):arguments.length<2?t instanceof Xt?new Xt(t.l,t.a,t.b):t instanceof Gt?Yt(t.h,t.c,t.l):fe((t=ae(t)).r,t.g,t.b):new Xt(t,e,r)}Wt.brighter=function(t){return new Gt(this.h,this.c,Math.min(100,this.l+Zt*(arguments.length?t:1)))},Wt.darker=function(t){return new Gt(this.h,this.c,Math.max(0,this.l-Zt*(arguments.length?t:1)))},Wt.rgb=function(){return Yt(this.h,this.c,this.l).rgb()},t.lab=Xt;var Zt=18,$t=.95047,Jt=1,Kt=1.08883,Qt=Xt.prototype=new Vt;function te(t,e,r){var n=(t+16)/116,i=n+e/500,a=n-r/200;return new ae(ie(3.2404542*(i=re(i)*$t)-1.5371385*(n=re(n)*Jt)-.4985314*(a=re(a)*Kt)),ie(-.969266*i+1.8760108*n+.041556*a),ie(.0556434*i-.2040259*n+1.0572252*a))}function ee(t,e,r){return t>0?new Gt(Math.atan2(r,e)*Lt,Math.sqrt(e*e+r*r),t):new Gt(NaN,NaN,t)}function re(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function ne(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function ie(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function ae(t,e,r){return this instanceof ae?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof ae?new ae(t.r,t.g,t.b):ue(""+t,ae,Ht):new ae(t,e,r)}function oe(t){return new ae(t>>16,t>>8&255,255&t)}function se(t){return oe(t)+""}Qt.brighter=function(t){return new Xt(Math.min(100,this.l+Zt*(arguments.length?t:1)),this.a,this.b)},Qt.darker=function(t){return new Xt(Math.max(0,this.l-Zt*(arguments.length?t:1)),this.a,this.b)},Qt.rgb=function(){return te(this.l,this.a,this.b)},t.rgb=ae;var le=ae.prototype=new Vt;function ce(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function ue(t,e,r){var n,i,a,o=0,s=0,l=0;if(n=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(i=n[2].split(","),n[1]){case"hsl":return r(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return e(de(i[0]),de(i[1]),de(i[2]))}return(a=ge.get(t))?e(a.r,a.g,a.b):(null==t||"#"!==t.charAt(0)||isNaN(a=parseInt(t.slice(1),16))||(4===t.length?(o=(3840&a)>>4,o|=o>>4,s=240&a,s|=s>>4,l=15&a,l|=l<<4):7===t.length&&(o=(16711680&a)>>16,s=(65280&a)>>8,l=255&a)),e(o,s,l))}function he(t,e,r){var n,i,a=Math.min(t/=255,e/=255,r/=255),o=Math.max(t,e,r),s=o-a,l=(o+a)/2;return s?(i=l<.5?s/(o+a):s/(2-o-a),n=t==o?(e-r)/s+(e=o)d(c,u,C--,L=L-o|0);else if(L>=0)d(s,l,E--,L);else if(L<=-o){L=-L-o|0;for(var z=0;zs&&(r=s-l),a=r;a>=0;a--){for(var h=!0,f=0;f0&&l.push(["index[",h,"]-=s",h].join("")),l.push(["++index[",u,"]"].join(""))),l.push("}")}return l.join("\n")}function a(t,e,r){for(var n=t.body,i=[],a=[],o=0;oh;)f.pop(),--p;var d,g=new Array(p+1);for(a=0;a<=p;++a)(d=g[a]=[]).x0=a>0?f[a-1]:u,d.x1=a=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),J.hasOwnProperty(r)?{space:J[r],local:t}:t}},Y.attr=function(e,r){if(arguments.length<2){if("string"==typeof e){var n=this.node();return(e=t.ns.qualify(e)).local?n.getAttributeNS(e.space,e.local):n.getAttribute(e)}for(r in e)this.each(K(r,e[r]));return this}return this.each(K(e,r))},Y.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=et(t)).length,i=-1;if(e=r.classList){for(;++i