<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Software for Exploratory Data Analysis and Statistical Modelling</title>
	<atom:link href="http://www.wekaleamstudios.co.uk/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.wekaleamstudios.co.uk</link>
	<description>Statistical Modelling with R</description>
	<lastBuildDate>Sat, 05 May 2012 16:49:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Theme Elements in ggplot2</title>
		<link>http://www.wekaleamstudios.co.uk/posts/theme-elements-in-ggplot2/</link>
		<comments>http://www.wekaleamstudios.co.uk/posts/theme-elements-in-ggplot2/#comments</comments>
		<pubDate>Thu, 03 May 2012 19:43:29 +0000</pubDate>
		<dc:creator>Ralph</dc:creator>
				<category><![CDATA[Grammar of Graphics]]></category>
		<category><![CDATA[ggplot2]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://www.wekaleamstudios.co.uk/?p=1831</guid>
		<description><![CDATA[This website provides a simple summary of the theme elements that can be set within ggplot2. There should be sufficient information here to change the default settings for graphs within the ggplot2 package.]]></description>
			<content:encoded><![CDATA[<p>This <a href="http://sape.inf.usi.ch/quick-reference/ggplot2/themes">website</a> provides a simple summary of the theme elements that can be set within <a href="http://had.co.nz/ggplot2/">ggplot2</a>. There should be sufficient information here to change the default settings for graphs within the ggplot2 package.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wekaleamstudios.co.uk/posts/theme-elements-in-ggplot2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Melt</title>
		<link>http://www.wekaleamstudios.co.uk/posts/melt/</link>
		<comments>http://www.wekaleamstudios.co.uk/posts/melt/#comments</comments>
		<pubDate>Thu, 05 Apr 2012 09:42:07 +0000</pubDate>
		<dc:creator>Ralph</dc:creator>
				<category><![CDATA[Data Manipulation]]></category>
		<category><![CDATA[data frame]]></category>
		<category><![CDATA[melt]]></category>
		<category><![CDATA[reshape]]></category>
		<category><![CDATA[reshape2]]></category>

		<guid isPermaLink="false">http://www.wekaleamstudios.co.uk/?p=1807</guid>
		<description><![CDATA[There are many situations where data is presented in a format that is not ready to dive straight to exploratory data analysis or to use a desired statistical method. The reshape2 package for R provides useful functionality to avoid having to hack data around in a spreadsheet prior to import into R. The melt function [...]]]></description>
			<content:encoded><![CDATA[<p>There are many situations where data is presented in a format that is not ready to dive straight to exploratory data analysis or to use a desired statistical method. The <strong>reshape2</strong> package for <strong>R</strong> provides useful functionality to avoid having to hack data around in a spreadsheet prior to import into <strong>R</strong>.<span id="more-1807"></span></p>
<p>The <strong>melt</strong> function takes data in wide format and stacks a set of columns into a single column of data. To make use of the function we need to specify a data frame, the id variables (which will be left at their settings) and the measured variables (columns of data) to be stacked. The default assumption on measured variables is that it is all columns that are not specified as id variables.</p>
<p>Consider the following set of data:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">&gt; dat
  FactorA FactorB     Group1     Group2     Group3      Group4
1     Low     Low -1.1616334 -0.5228371 -0.6587093  0.45064563
2  Medium     Low -0.5991478 -1.0461138 -0.1942979  2.47985577
3    High     Low  0.8420797 -1.5413266  0.6318852 -0.98948125
4     Low  Medium  1.6225569 -1.2706469 -0.8026467 -0.32332181
5  Medium  Medium -0.3450745 -1.3377985  1.4988363  0.36541918
6    High  Medium  1.6025044  0.7631882 -0.5375833  0.85028148
7     Low    High -1.2991011 -0.2223622 -0.6321478 -1.57284216
8  Medium    High -0.4906400 -1.1802192  0.1235253  0.09891793
9    High    High  0.3897769 -0.3832142  0.6671101  0.23407257</pre></div></div>

<p>There four groups are to used as part of a statistical analysis so we want to stack them into a single column and create an factor variable to indicate which group the measurement corresponds to and the <strong>melt</strong> function does the trick:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">&gt; melt(dat)
Using FactorA, FactorB as id variables
   FactorA FactorB variable       value
1      Low     Low   Group1 -1.16163338
2   Medium     Low   Group1 -0.59914783
3     High     Low   Group1  0.84207974
4      Low  Medium   Group1  1.62255690
5   Medium  Medium   Group1 -0.34507455
6     High  Medium   Group1  1.60250438
&nbsp;
...
36    High    High   Group4  0.23407257</pre></div></div>

<p>Consider a second set of data where there are two groups but we only want to retain the FactorB variable in the molten data set:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">   FactorA   FactorB   Group1   Group2
1      Low  Very Low 6.851828 3.061329
2   Medium  Very Low 7.352169 1.303077
3     High  Very Low 6.918091 2.477875
4      Low       Low 7.402351 2.450527
5   Medium       Low 6.928385 4.334323
6     High       Low 7.400626 3.074158
7      Low    Medium 8.312145 5.725185
8   Medium    Medium 8.251806 4.384492
9     High    Medium 8.339398 3.443789
10     Low      High 5.127386 2.868952
11  Medium      High 8.561181 3.616898
12    High      High 6.993838 3.450634
13     Low Very High 7.880877 2.950622
14  Medium Very High 9.439892 3.220295
15    High Very High 8.799447 3.106060</pre></div></div>

<p>We now need to specify both the <strong>id.vars</strong> and <strong>measure.vars</strong> arguments in the <strong>melt</strong> function to get the desired output:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">&gt; melt(dat, id.vars = &quot;FactorB&quot;, measure.vars = c(&quot;Group1&quot;, &quot;Group2&quot;))
     FactorB variable    value
1   Very Low   Group1 6.851828
2   Very Low   Group1 7.352169
3   Very Low   Group1 6.918091
4        Low   Group1 7.402351
5        Low   Group1 6.928385
6        Low   Group1 7.400626
...
30 Very High   Group2 3.106060</pre></div></div>

<p>Other useful resources are provided on the <a href="http://www.wekaleamstudios.co.uk/supplementary-material/">Supplementary Material</a> page.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wekaleamstudios.co.uk/posts/melt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tikz Paths and Decorations</title>
		<link>http://www.wekaleamstudios.co.uk/posts/tikz-paths-and-decorations/</link>
		<comments>http://www.wekaleamstudios.co.uk/posts/tikz-paths-and-decorations/#comments</comments>
		<pubDate>Sat, 17 Mar 2012 07:02:11 +0000</pubDate>
		<dc:creator>Ralph</dc:creator>
				<category><![CDATA[tikz/pgf]]></category>
		<category><![CDATA[decorations]]></category>
		<category><![CDATA[inner sep]]></category>
		<category><![CDATA[paths]]></category>
		<category><![CDATA[tikz]]></category>
		<category><![CDATA[ultra thick]]></category>
		<category><![CDATA[very thin]]></category>
		<category><![CDATA[\draw]]></category>

		<guid isPermaLink="false">http://www.wekaleamstudios.co.uk/?p=1721</guid>
		<description><![CDATA[The tikz drawing system can be used to draw basic solid black lines and simple shapes which can reasonably easily be adjusted to allow alternative patterns and decorations. Fast Tube by Casper The thickness of a line can be specified as part of a \draw command so when drawing a grid with thinner than standard [...]]]></description>
			<content:encoded><![CDATA[<p>The <strong>tikz</strong> drawing system can be used to draw basic solid black lines and simple shapes which can reasonably easily be adjusted to allow alternative patterns and decorations.<span id="more-1721"></span></p>
<p><!--[Fast Tube]--><span id="lIDtt0VooY4" style="display:block;"><a title="Click here to watch this video!" href="http://www.wekaleamstudios.co.uk/posts/tikz-paths-and-decorations/#lIDtt0VooY4"><img src="http://i.ytimg.com/vi/lIDtt0VooY4/0.jpg" alt="Fast Tube" border="0" width="320" height="240" /></a><br /><small>Fast Tube by <a title="Casper's Blog" href="http://blog.caspie.net/">Casper</a></small></span><!--[/Fast Tube]--></p>
<p>The thickness of a line can be specified as part of a <strong>\draw</strong> command so when drawing a grid with thinner than standard lines we could add the <strong>very thin</strong> option to the <strong>tikz</strong> code:</p>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #800000; font-weight: normal;">\draw</span><span style="color: #E02020; ">[</span><span style="color: #C08020; font-weight: normal;">step=.5cm,very thin,black!20</span><span style="color: #E02020; ">]</span> (0,0) grid (6,6);</pre></div></div>

<p>The line pattern can also be specified as part of the draw options and the available patterns include <strong>solid</strong> lines, <strong>dashed</strong> lines and <strong>dotted</strong> lines:</p>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #800000; font-weight: normal;">\draw</span><span style="color: #E02020; ">[</span><span style="color: #C08020; font-weight: normal;">solid,-&gt;</span><span style="color: #E02020; ">]</span> (0,0) -- (6,0);
<span style="color: #800000; font-weight: normal;">\draw</span><span style="color: #E02020; ">[</span><span style="color: #C08020; font-weight: normal;">dashed,&lt;-</span><span style="color: #E02020; ">]</span> (0,1) -- (6,1);
<span style="color: #800000; font-weight: normal;">\draw</span><span style="color: #E02020; ">[</span><span style="color: #C08020; font-weight: normal;">dotted,&lt;-&gt;</span><span style="color: #E02020; ">]</span> (0,2) -- (6,2);
<span style="color: #800000; font-weight: normal;">\draw</span><span style="color: #E02020; ">[</span><span style="color: #E02020; "><span style="color: #C08020; font-weight: normal;">solid,|&lt;-&gt;|</span></span><span style="color: #E02020; ">]</span> (0,3) -- (6,3);</pre></div></div>

<p>These settings can also be applied to decorations around nodes such as boxes. The command below draws a box with a blue outline filled with a background shade of red. The outline of the box around the node is thicker than usual (<strong>ultra thick</strong>) and the box itself is rectangular with rounded corners. The last option <strong>inner sep</strong> adds some padding inside the box around the text.</p>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #800000; font-weight: normal;">\node</span><span style="color: #E02020; ">[</span><span style="color: #C08020; font-weight: normal;">draw=blue,fill=red!40,ultra thick,rectangle,rounded corners,
  inner sep=10pt</span><span style="color: #E02020; ">]</span> (b1) <span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">Example</span><span style="color: #E02020; ">}</span>;</pre></div></div>

<p>Other useful resources are provided on the <a href="http://www.wekaleamstudios.co.uk/supplementary-material/">Supplementary Material</a> page.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wekaleamstudios.co.uk/posts/tikz-paths-and-decorations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Useful functions for data frames in R</title>
		<link>http://www.wekaleamstudios.co.uk/posts/useful-functions-for-data-frames-in-r/</link>
		<comments>http://www.wekaleamstudios.co.uk/posts/useful-functions-for-data-frames-in-r/#comments</comments>
		<pubDate>Fri, 17 Feb 2012 08:55:08 +0000</pubDate>
		<dc:creator>Ralph</dc:creator>
				<category><![CDATA[S Programming]]></category>
		<category><![CDATA[data frame]]></category>
		<category><![CDATA[duplicated]]></category>
		<category><![CDATA[expand.grid]]></category>
		<category><![CDATA[head]]></category>
		<category><![CDATA[tail]]></category>

		<guid isPermaLink="false">http://www.wekaleamstudios.co.uk/?p=1766</guid>
		<description><![CDATA[This post will consider some useful functions for dealing with data frames during data processing and validation. Consider an artifical data set create using the expand.grid function where there are duplicate rows in the data frame. &#62; des = expand.grid(A = c(2,2,3,4), B = c(1,3,5,5,7)) &#62; des A B 1 2 1 2 2 1 [...]]]></description>
			<content:encoded><![CDATA[<p>This post will consider some useful functions for dealing with data frames during data processing and validation.<span id="more-1766"></span></p>
<p>Consider an artifical data set create using the <strong>expand.grid</strong> function where there are duplicate rows in the data frame.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">&gt; des = expand.grid(A = c(2,2,3,4), B = c(1,3,5,5,7))
&gt; des
   A B
1  2 1
2  2 1
3  3 1
4  4 1
5  2 3
6  2 3
7  3 3
8  4 3
9  2 5
10 2 5
11 3 5
12 4 5
13 2 5
14 2 5
15 3 5
16 4 5
17 2 7
18 2 7
19 3 7
20 4 7</pre></div></div>

<p>If we want to identify rows that are duplicates then the <strong>duplicated</strong> function comes in handy:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">&gt; duplicated(des)
 [1] FALSE  TRUE FALSE FALSE FALSE  TRUE FALSE FALSE
 FALSE  TRUE FALSE FALSE  TRUE  TRUE  TRUE  TRUE FALSE  TRUE FALSE FALSE</pre></div></div>

<p>We can pick out the unique rows of the data frame with the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">&gt; des[!duplicated(des),]
   A B
1  2 1
3  3 1
4  4 1
5  2 3
7  3 3
8  4 3
9  2 5
11 3 5
12 4 5
17 2 7
19 3 7
20 4 7</pre></div></div>

<p>After loading a large file into a data frame we might be interested in checking some of the data to ensure that it is as expected. Rather than printing out the entirity of the data frame we can use the <strong>head</strong> and <strong>tail</strong> functions to view the top or bottom few rows of the data frame. An example using the rock data set that is available within R:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">&gt; head(rock)
  area    peri     shape perm
1 4990 2791.90 0.0903296  6.3
2 7002 3892.60 0.1486220  6.3
3 7558 3930.66 0.1833120  6.3
4 7352 3869.32 0.1170630  6.3
5 7943 3948.54 0.1224170 17.1
6 7979 4010.15 0.1670450 17.1
&gt; tail(rock)
   area     peri    shape perm
43 5605 1145.690 0.464125 1300
44 8793 2280.490 0.420477 1300
45 3475 1174.110 0.200744  580
46 1651  597.808 0.262651  580
47 5514 1455.880 0.182453  580
48 9718 1485.580 0.200447  580</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.wekaleamstudios.co.uk/posts/useful-functions-for-data-frames-in-r/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Surfaces in ternary plots</title>
		<link>http://www.wekaleamstudios.co.uk/posts/surfaces-in-ternary-plots/</link>
		<comments>http://www.wekaleamstudios.co.uk/posts/surfaces-in-ternary-plots/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 19:44:22 +0000</pubDate>
		<dc:creator>Ralph</dc:creator>
				<category><![CDATA[Lattice Graphics]]></category>
		<category><![CDATA[levelplot]]></category>
		<category><![CDATA[mixture]]></category>
		<category><![CDATA[surface]]></category>
		<category><![CDATA[ternary plot]]></category>

		<guid isPermaLink="false">http://www.wekaleamstudios.co.uk/?p=1782</guid>
		<description><![CDATA[In mixture experiments there is a constraint that the variables are the proportions of components that are mixed together with the consequence that these proportions sum to one. When fitting regression models to data from mixture experiments we may be interested in reprenting the fitted model with a surface plot. The constraint on proportions means [...]]]></description>
			<content:encoded><![CDATA[<p>In mixture experiments there is a constraint that the variables are the proportions of components that are mixed together with the consequence that these proportions sum to one. When fitting regression models to data from mixture experiments we may be interested in reprenting the fitted model with a surface plot.<span id="more-1782"></span></p>
<p>The constraint on proportions means that the mixture data can be described in one dimension lower than the total number of components. For example when there are three mixture components a two dimension plot can be used to represent the mixture within an equilateral triangle.</p>
<p>To create a surface within the mixture triangle we can create a grid of points and then convert these pairs of points into mixture triples.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">mygrid = rbind(
	expand.grid(
		x = seq(0, 1.0, length.out = 500),
		y = seq(0, sqrt(3)/2, length.out = 500)
	)
)</pre></div></div>

<p>The conversion formulae are shown below:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">mygrid$a = (sqrt(3) * (mygrid$x - 0.5) + (mygrid$y - 0.5 * sqrt(3))) /
  (- sqrt(3) - 0.5 * sqrt(3))
mygrid$b = (- sqrt(3) * (mygrid$x - 0.5) + (mygrid$y - 0.5 * sqrt(3))) /
  (- sqrt(3) - 0.5 * sqrt(3))
mygrid$c = 1 - mygrid$a - mygrid$b</pre></div></div>

<p>The next step is to calculate our surface values, a trivial example of which is:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">mygrid$z = 10 + 4 * mygrid$a + 3 * mygrid$b</pre></div></div>

<p>We then need to <em>trick</em> the plotting function by setting all invalid mixture combinations to be missing values.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">mygrid$z[mygrid$a &lt; 0 | mygrid$b &lt; 0 | mygrid$c &lt; 0] = NA
mygrid$z[mygrid$a &gt; 1 | mygrid$b &gt; 1 | mygrid$c &gt; 1] = NA</pre></div></div>

<p>Lastly we use the levelplot function in the lattice package.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">trellis.par.set(&quot;axis.line&quot;,list(col=NA,lty=1,lwd=1))
levelplot(z ~ x*y, data = mygrid,
	col.regions = gray(101:0/101), scales = list(draw=FALSE),
	xlab = &quot;&quot;, ylab = &quot;&quot;,
	panel = function(x, y, z, ...)
	{
		panel.levelplot(x, y, z, ...)
		panel.lines(c(0,1), c(0,0), col = &quot;black&quot;)
		panel.lines(c(0,0.5), c(0,sqrt(3)/2), col = &quot;black&quot;)
		panel.lines(c(0.5,1), c(sqrt(3)/2,0), col = &quot;black&quot;)
		panel.text(0.5, sqrt(3)/2, &quot;C&quot;, pos=3)
		panel.text(0, 0, &quot;A&quot;, pos=2)
		panel.text(1, 0, &quot;B&quot;, pos=4)
	},
	xlim = c(-0.2,1.2),
	ylim = c(-0.2, 0.2+sqrt(3)/2)
)</pre></div></div>

<p>This forms the basis of a ternary surface plot and various adjustments can be easily made to customise the plot.</p>
<div id="attachment_1792" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.wekaleamstudios.co.uk/wp-content/uploads/2012/02/ternaryplot.png"><img src="http://www.wekaleamstudios.co.uk/wp-content/uploads/2012/02/ternaryplot-300x300.png" alt="Ternary Plot" title="Ternary Plot" width="300" height="300" class="size-medium wp-image-1792" /></a><p class="wp-caption-text">Example of a surface plot in a ternary diagram</p></div>
<p>Other useful resources are provided on the <a href="http://www.wekaleamstudios.co.uk/supplementary-material/">Supplementary Material</a> page.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wekaleamstudios.co.uk/posts/surfaces-in-ternary-plots/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>A3 pages in LaTeX documents</title>
		<link>http://www.wekaleamstudios.co.uk/posts/a3-pages-in-latex-documents/</link>
		<comments>http://www.wekaleamstudios.co.uk/posts/a3-pages-in-latex-documents/#comments</comments>
		<pubDate>Fri, 02 Dec 2011 16:38:58 +0000</pubDate>
		<dc:creator>Ralph</dc:creator>
				<category><![CDATA[LaTeX Typesetting]]></category>
		<category><![CDATA[a3paper]]></category>
		<category><![CDATA[geometry]]></category>

		<guid isPermaLink="false">http://www.wekaleamstudios.co.uk/?p=1758</guid>
		<description><![CDATA[The default paper sizes in LaTeX documents tend to be A4 or letter paper. If we want to use other page and paper sizes the geometry package is a handy way to make these changes. To change the paper to A3 in our document and in landscape orientation we would use the following: \documentclass[12pt,landscape]{article} \usepackage[a3paper]{geometry} [...]]]></description>
			<content:encoded><![CDATA[<p>The default paper sizes in <strong>LaTeX</strong> documents tend to be A4 or letter paper. If we want to use other page and paper sizes the <strong>geometry</strong> package is a handy way to make these changes.<span id="more-1758"></span></p>
<p>To change the paper to A3 in our document and in landscape orientation we would use the following:</p>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #E02020; ">\</span><span style="color: #800000;">documentclass</span><span style="color: #E02020; ">[</span><span style="color: #C08020; font-weight: normal;">12pt,landscape</span><span style="color: #E02020; ">]{</span><span style="color: #2020C0; font-weight: normal;">article</span><span style="color: #E02020; ">}</span>
<span style="color: #E02020; ">\</span><span style="color: #800000;">usepackage</span><span style="color: #E02020; ">[</span><span style="color: #C08020; font-weight: normal;">a3paper</span><span style="color: #E02020; ">]{</span><span style="color: #2020C0; font-weight: normal;">geometry</span><span style="color: #E02020; ">}</span>
<span style="color: #C00000; font-weight: normal;">\begin</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #0000D0; font-weight: normal;">document</span></span><span style="color: #E02020; ">}</span>
...
<span style="color: #C00000; font-weight: normal;">\end</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #0000D0; font-weight: normal;">document</span></span><span style="color: #E02020; ">}</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.wekaleamstudios.co.uk/posts/a3-pages-in-latex-documents/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tikz absolute positioning</title>
		<link>http://www.wekaleamstudios.co.uk/posts/tikz-absolute-positioning/</link>
		<comments>http://www.wekaleamstudios.co.uk/posts/tikz-absolute-positioning/#comments</comments>
		<pubDate>Sun, 20 Nov 2011 16:55:44 +0000</pubDate>
		<dc:creator>Ralph</dc:creator>
				<category><![CDATA[LaTeX Typesetting]]></category>
		<category><![CDATA[tikz/pgf]]></category>
		<category><![CDATA[absolute]]></category>
		<category><![CDATA[current.page]]></category>
		<category><![CDATA[node]]></category>
		<category><![CDATA[positioning]]></category>
		<category><![CDATA[tikz]]></category>

		<guid isPermaLink="false">http://www.wekaleamstudios.co.uk/?p=1742</guid>
		<description><![CDATA[When working with a tikz drawing within LaTeX document we might want to locate an object using an absolute position on the page rather than leaving LaTeX to make the decision for us. The use of nodes and the current.page label in conjunction with some other parameters attached to the tikz drawing will allow us [...]]]></description>
			<content:encoded><![CDATA[<p>When working with a <strong>tikz</strong> drawing within <strong>LaTeX</strong> document we might want to locate an object using an absolute position on the page rather than leaving <strong>LaTeX</strong> to make the decision for us.<span id="more-1742"></span></p>
<p>The use of nodes and the <strong>current.page</strong> label in conjunction with some other parameters attached to the <strong>tikz</strong> drawing will allow us to achieve the absolute positioning on the page.</p>
<p>As an example consider a one page drawing where we want to put a text box in the centre of the page.</p>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #C00000; font-weight: normal;">\begin</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #0000D0; font-weight: normal;">tikzpicture</span></span><span style="color: #E02020; ">}[</span><span style="color: #C08020; font-weight: normal;">remember picture,overlay</span><span style="color: #E02020; ">]</span>
<span style="color: #800000; font-weight: normal;">\draw</span> (current page.center) node <span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">Add Text</span><span style="color: #E02020; ">}</span>;
<span style="color: #C00000; font-weight: normal;">\end</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #0000D0; font-weight: normal;">tikzpicture</span></span><span style="color: #E02020; ">}</span></pre></div></div>

<p>If we wanted to add elements to the edge of a page we could use the <strong>current page.north west</strong> anchor to locate in the top left of the page.</p>
<p>Other useful resources are provided on the <a href="http://www.wekaleamstudios.co.uk/supplementary-material/">Supplementary Material</a> page.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wekaleamstudios.co.uk/posts/tikz-absolute-positioning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tikz Nodes</title>
		<link>http://www.wekaleamstudios.co.uk/posts/tikz-nodes/</link>
		<comments>http://www.wekaleamstudios.co.uk/posts/tikz-nodes/#comments</comments>
		<pubDate>Mon, 17 Oct 2011 07:01:20 +0000</pubDate>
		<dc:creator>Ralph</dc:creator>
				<category><![CDATA[LaTeX Typesetting]]></category>
		<category><![CDATA[tikz/pgf]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[node]]></category>
		<category><![CDATA[tikz]]></category>
		<category><![CDATA[\draw]]></category>

		<guid isPermaLink="false">http://www.wekaleamstudios.co.uk/?p=1718</guid>
		<description><![CDATA[Nodes are used in tikz to place content in a picture as part of a LaTeX document. Fast Tube by Casper When creating a tikz picture the origin is assumed to be at (0,0) and objects are placed with positioning relative to the origin on the picture. If we wanted to add a grid with [...]]]></description>
			<content:encoded><![CDATA[<p>Nodes are used in <strong>tikz</strong> to place content in a picture as part of a <strong>LaTeX</strong> document.<span id="more-1718"></span></p>
<p><!--[Fast Tube]--><span id="q-4f0XiuYwc" style="display:block;"><a title="Click here to watch this video!" href="http://www.wekaleamstudios.co.uk/posts/tikz-nodes/#q-4f0XiuYwc"><img src="http://i.ytimg.com/vi/q-4f0XiuYwc/0.jpg" alt="Fast Tube" border="0" width="320" height="240" /></a><br /><small>Fast Tube by <a title="Casper's Blog" href="http://blog.caspie.net/">Casper</a></small></span><!--[/Fast Tube]--></p>
<p>When creating a tikz picture the origin is assumed to be at (0,0) and objects are placed with positioning relative to the origin on the picture. If we wanted to add a grid with lines from -3 to +3 in both the horizontal and vertical axes then we would use the <strong>\draw</strong> command combined with <strong>grid</strong>.</p>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #800000; font-weight: normal;">\draw</span> (-3,-3) grid (3,3);</pre></div></div>

<p>We can use the draw options to change how the grid is displayed. To make the grid lines thin we could add <i>very thin</i> and change the colour to a light gray (<i>black!20</i>):</p>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #800000; font-weight: normal;">\draw</span><span style="color: #E02020; ">[</span><span style="color: #C08020; font-weight: normal;">very thin,black!20</span><span style="color: #E02020; ">]</span> (-3,-3) grid (3,3);</pre></div></div>

<p>To add a node with text we use a combination of <strong>\draw</strong> and <strong>node</strong>, For example to put the node with a single letter A at (1,1):</p>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #800000; font-weight: normal;">\draw</span> (1,1) node <span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">A</span><span style="color: #E02020; ">}</span>;</pre></div></div>

<p>We can put an outline around the text in a node by specifying a <em>shape</em> and the <em>draw</em> option (which refers to the colour of the outline of the shape).</p>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #800000; font-weight: normal;">\node</span><span style="color: #E02020; ">[</span><span style="color: #C08020; font-weight: normal;">shape=rectangle,draw=black</span><span style="color: #E02020; ">]</span> at (0,2) <span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">B</span><span style="color: #E02020; ">}</span>;</pre></div></div>

<p>The <i>fill</i> option is for the inside of the shape. A circle with outline and filled background could be drawn with the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #800000; font-weight: normal;">\node</span><span style="color: #E02020; ">[</span><span style="color: #C08020; font-weight: normal;">shape=circle,draw=blue,fill=blue!50</span><span style="color: #E02020; ">]</span> at (2,2) <span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">D</span><span style="color: #E02020; ">}</span>;</pre></div></div>

<p>Other useful resources are provided on the <a href="http://www.wekaleamstudios.co.uk/supplementary-material/">Supplementary Material</a> page.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wekaleamstudios.co.uk/posts/tikz-nodes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tikz Introduction</title>
		<link>http://www.wekaleamstudios.co.uk/posts/tikz-introduction/</link>
		<comments>http://www.wekaleamstudios.co.uk/posts/tikz-introduction/#comments</comments>
		<pubDate>Tue, 27 Sep 2011 17:43:10 +0000</pubDate>
		<dc:creator>Ralph</dc:creator>
				<category><![CDATA[LaTeX Typesetting]]></category>
		<category><![CDATA[tikz/pgf]]></category>
		<category><![CDATA[drawing]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[latex]]></category>
		<category><![CDATA[pgf]]></category>
		<category><![CDATA[tikz]]></category>
		<category><![CDATA[\draw]]></category>

		<guid isPermaLink="false">http://www.wekaleamstudios.co.uk/?p=1698</guid>
		<description><![CDATA[The pgf drawing package for LaTeX provides facilities for drawing simple of complicated pictures within a LaTeX document. There are many options available within the package and in this post we consider some of the basics to get up and running. Fast Tube by Casper As with all LaTeX documents we need to select a [...]]]></description>
			<content:encoded><![CDATA[<p>The <strong>pgf</strong> drawing package for <strong>LaTeX</strong> provides facilities for drawing simple of complicated pictures within a <strong>LaTeX</strong> document. There are many options available within the package and in this post we consider some of the basics to get up and running.<span id="more-1698"></span></p>
<p><!--[Fast Tube]--><span id="7KO-X03lW6Q" style="display:block;"><a title="Click here to watch this video!" href="http://www.wekaleamstudios.co.uk/posts/tikz-introduction/#7KO-X03lW6Q"><img src="http://i.ytimg.com/vi/7KO-X03lW6Q/0.jpg" alt="Fast Tube" border="0" width="320" height="240" /></a><br /><small>Fast Tube by <a title="Casper's Blog" href="http://blog.caspie.net/">Casper</a></small></span><!--[/Fast Tube]--></p>
<p>As with all LaTeX documents we need to select a document class and include some preamble material prior to the body of our document. A blank template for a document with a single tikz picture is shown here:</p>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #E02020; ">\</span><span style="color: #800000;">documentclass</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">article</span><span style="color: #E02020; ">}</span>
<span style="color: #E02020; ">\</span><span style="color: #800000;">usepackage</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">tikz</span><span style="color: #E02020; ">}</span>
<span style="color: #C00000; font-weight: normal;">\begin</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #0000D0; font-weight: normal;">document</span></span><span style="color: #E02020; ">}</span>
<span style="color: #E02020; ">\</span><span style="color: #800000;">pagestyle</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">empty</span><span style="color: #E02020; ">}</span>
<span style="color: #C00000; font-weight: normal;">\begin</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #0000D0; font-weight: normal;">tikzpicture</span></span><span style="color: #E02020; ">}</span>
...
<span style="color: #C00000; font-weight: normal;">\end</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #0000D0; font-weight: normal;">tikzpicture</span></span><span style="color: #E02020; ">}</span>
<span style="color: #C00000; font-weight: normal;">\end</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #0000D0; font-weight: normal;">document</span></span><span style="color: #E02020; ">}</span></pre></div></div>

<p>The tikz picture has a coordinate system similar to that which you would expect where moving from left to right on the page corresponds to increasing the x value and bottom to top increases the y value. A line can be drawn between two points wit the <strong>\draw</strong> command:</p>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #800000; font-weight: normal;">\draw</span> (0,0) -- (1,0);</pre></div></div>

<p>To draw a line between multiple points these can be chained together in a single draw command:</p>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #800000; font-weight: normal;">\draw</span> (0,0) -- (1,0) -- (1, 4);</pre></div></div>

<p>The line style can be altered by adding various options in square brackets directly after the draw command. So to change to a dashed red line we would write the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #800000; font-weight: normal;">\draw</span><span style="color: #E02020; ">[</span><span style="color: #C08020; font-weight: normal;">red,dashed</span><span style="color: #E02020; ">]</span> (0,0) -- (2,0);</pre></div></div>

<p>A circle of a given radius can be draw using the <strong>\draw</strong> command and we specify the radius of the circle in round brackets:</p>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #800000; font-weight: normal;">\draw</span> (0,0) circle (2.5cm);</pre></div></div>

<p>This will draw a circle with radius of 2.5 cm. The circle could be changed into an ellipse and we would then need to specify the radius in two directions, an example of this:</p>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #800000; font-weight: normal;">\draw</span> (0,0) ellipse (2cm and 3.5cm);</pre></div></div>

<p>Other useful resources are provided on the <a href="http://www.wekaleamstudios.co.uk/supplementary-material/">Supplementary Material</a> page.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wekaleamstudios.co.uk/posts/tikz-introduction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cricket All Round Performances</title>
		<link>http://www.wekaleamstudios.co.uk/posts/cricket-all-round-performances/</link>
		<comments>http://www.wekaleamstudios.co.uk/posts/cricket-all-round-performances/#comments</comments>
		<pubDate>Mon, 19 Sep 2011 22:12:43 +0000</pubDate>
		<dc:creator>Ralph</dc:creator>
				<category><![CDATA[R Environment]]></category>
		<category><![CDATA[batting]]></category>
		<category><![CDATA[bowling]]></category>
		<category><![CDATA[cricket]]></category>
		<category><![CDATA[runs]]></category>
		<category><![CDATA[wickets]]></category>

		<guid isPermaLink="false">http://www.wekaleamstudios.co.uk/?p=1685</guid>
		<description><![CDATA[In cricket a player who can perform well with both the bat and bowl is a great asset for any team and across the history of international cricket there have been a number of cricketers that hall into this bracket. It is difficult to specify a set of criteria to determine whether a player can [...]]]></description>
			<content:encoded><![CDATA[<p>In cricket a player who can perform well with both the bat and bowl is a great asset for any team and across the history of international cricket there have been a number of cricketers that hall into this bracket.<span id="more-1685"></span></p>
<p>It is difficult to specify a set of criteria to determine whether a player can be described as an all-rounder. To compare the performances of various all-rounders we can look at the subset of crickters who have scored at least 1,000 runs and taken at least 100 wickets at Test Match level. This is not a perfect criteria as there will be players who have taken part in sufficient test matches that they will be included even though they are clearly much stronger in one of the two disciplines but very handy in the other.</p>
<p>A total of 54 test match cricketers were identified based on this criteria (up to and including test match 2004) and a scatter plot of the performances can be seen <a href='http://www.wekaleamstudios.co.uk/wp-content/uploads/2011/09/allrounder-graph1.pdf'>here</a>. The graph shows that the majority of players in the bottom left region of the graph with a handful of batsmen and bowlers at the extremes in terms of runs or wickets.</p>
<p>To get a better idea of the balance between wickets and runs we can zoom in on the bottom left hand region of the graph to get this <a href='http://www.wekaleamstudios.co.uk/wp-content/uploads/2011/09/allrounder-graph2.pdf'>display</a>. This new graph suggests that although there have been a number of English cricketers that has scored 1,000 runs and taken 100 wickets they do not have the longevity of players from other countries.</p>
<p>There are naturally other measures of performance that could be used to compare this set of allround cricketers which might provided a more illuminating insight into all round performances.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wekaleamstudios.co.uk/posts/cricket-all-round-performances/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

