Commit 6d616ad3 authored by Martin Isaksson's avatar Martin Isaksson
Browse files

test

parent 83cfea51
......@@ -66,94 +66,14 @@ wash %>% head
Rearrange and plot `x`,`y` and `z` components.
{% highlight r %}
wash2 <- wash %>% select(-matches("magnitude"), -threshold) %>% gather("axis", "value",-time)
ggplot(wash2, aes(x=time, y=value, color=axis)) +
geom_line() +
theme_classic() +
facet_grid(axis~.) +
scale_colour_brewer(palette = "Set1")
{% endhighlight %}
![plot of chunk mag_axis](http://db.yihui.name/jekyll/2015-08-30-washing-machine/mag_axis-1.png)
Plot the magnitude
{% highlight r %}
ggplot(wash, aes(x=time, y=magnitude)) +
geom_line() +
theme_classic()
{% endhighlight %}
![plot of chunk mag1](http://db.yihui.name/jekyll/2015-08-30-washing-machine/mag1-1.png)
Plot the magnitude trend
{% highlight r %}
ggplot(wash, aes(x=time, y=magnitude_ema)) +
geom_line() +
theme_classic()
{% endhighlight %}
{% highlight text %}
## Warning: Removed 19 rows containing missing values (geom_path).
{% endhighlight %}
![plot of chunk mag2](http://db.yihui.name/jekyll/2015-08-30-washing-machine/mag2-1.png)
Plot the adjusted magnitude (removed magnitude trend).
{% highlight r %}
ggplot(wash, aes(x=time, y=magnitude_adj)) +
geom_line() +
theme_classic()
{% endhighlight %}
{% highlight text %}
## Warning: Removed 19 rows containing missing values (geom_path).
{% endhighlight %}
![plot of chunk mag3](http://db.yihui.name/jekyll/2015-08-30-washing-machine/mag3-1.png)
Plot the normalized absolute magnitude.
{% highlight r %}
ggplot(wash, aes(x=time, y=magnitude_abs)) +
geom_line() +
theme_classic()
{% endhighlight %}
{% highlight text %}
## Warning: Removed 68 rows containing missing values (geom_path).
{% endhighlight %}
![plot of chunk mag4](http://db.yihui.name/jekyll/2015-08-30-washing-machine/mag4-1.png)
Using zero as a threshold, plot on or off status.
{% highlight r %}
ggplot(wash, aes(x=time, y=threshold)) + geom_line()+ theme_classic()
{% endhighlight %}
{% highlight text %}
## Warning: Removed 68 rows containing missing values (geom_path).
{% endhighlight %}
![plot of chunk mag5](http://db.yihui.name/jekyll/2015-08-30-washing-machine/mag5-1.png)
local({
# fall back on '/' if baseurl is not specified
baseurl = servr:::jekyll_config('.', 'baseurl', '')
baseurl = servr:::jekyll_config('.', 'baseurl', '/')
knitr::opts_knit$set(base.url = baseurl)
# fall back on 'kramdown' if markdown engine is not specified
markdown = servr:::jekyll_config('.', 'markdown', 'kramdown')
......@@ -12,10 +12,9 @@ local({
# input/output filenames are passed as two additional arguments to Rscript
a = commandArgs(TRUE)
d = gsub('^_|[.][a-zA-Z]+$', '', a[1])
knitr::opts_chunk$set(
fig.path = sprintf('/figure/%s/', d),
cache.path = sprintf('/cache/%s/', d)
fig.path = sprintf('figure/%s/', d),
cache.path = sprintf('cache/%s/', d)
)
# set where you want to host the figures (I store them in my Dropbox Public
# folder, and you might prefer putting them in GIT)
......@@ -25,9 +24,9 @@ local({
knitr::opts_chunk$set(fig.path = sprintf('%s/', gsub('^.+/', '', d)))
knitr::opts_knit$set(
base.dir = '/',
base.url = ''
base.url = 'http://martisak.github.io'
)
}
knitr::opts_knit$set(width = 85)
knitr::opts_knit$set(width = 70)
knitr::knit(a[1], a[2], quiet = TRUE, encoding = 'UTF-8', envir = .GlobalEnv)
})
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment