-
Notifications
You must be signed in to change notification settings - Fork 0
/
week3.html
76 lines (76 loc) · 4.33 KB
/
week3.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="pandoc" />
<title></title>
<style type="text/css">code{white-space: pre;}</style>
<style type="text/css">
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
margin: 0; padding: 0; vertical-align: baseline; border: none; }
table.sourceCode { width: 100%; line-height: 100%; }
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
td.sourceCode { padding-left: 5px; }
code > span.kw { color: #007020; font-weight: bold; }
code > span.dt { color: #902000; }
code > span.dv { color: #40a070; }
code > span.bn { color: #40a070; }
code > span.fl { color: #40a070; }
code > span.ch { color: #4070a0; }
code > span.st { color: #4070a0; }
code > span.co { color: #60a0b0; font-style: italic; }
code > span.ot { color: #007020; }
code > span.al { color: #ff0000; font-weight: bold; }
code > span.fu { color: #06287e; }
code > span.er { color: #ff0000; font-weight: bold; }
</style>
<link rel="stylesheet" href="pandoc.css" type="text/css" />
</head>
<body>
<h1 id="week-3-rstudio-jupyter-notebooks-and-publication-quality-graphics">Week 3: Rstudio, Jupyter notebooks, and publication-quality graphics</h1>
<p>Background materials:</p>
<ul>
<li><a href="https://www.rstudio.com/">Rstudio website</a></li>
<li><a href="http://web.cs.ucla.edu/~gulzar/rstudio/basic-tutorial.html">Rstudio tutorial</a> from UCLA</li>
<li><a href="http://jupyter.org/">Jupyter project</a></li>
<li><a href="https://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/">Jupyter quickstart guide</a></li>
<li><a href="https://www.datacamp.com/community/tutorials/tutorial-jupyter-notebook">Jupyter notebook tutorial</a></li>
</ul>
<p><a href="LabNotebooks.html">Lecture notes</a></p>
<p>For the lab this week, we will work through this <a href="http://tutorials.iq.harvard.edu/R/Rgraphics/Rgraphics.html">set of exercises</a>.</p>
<p>If you know ggplot well already and/or have time, work through <a href="http://genomicsclass.github.io/book/pages/dplyr_tutorial.html">this</a> tutorial about dplyr.</p>
<p>Useful free resources:</p>
<ul>
<li><a href="http://zevross.com/blog/2014/08/04/beautiful-plotting-in-r-a-ggplot2-cheatsheet-3/">ggplot tutorial</a> from 2014.</li>
</ul>
<p>Books:</p>
<ul>
<li><a href="https://www.amazon.com/Data-Science-Transform-Visualize-Model/dp/1491910399/">R for data science</a></li>
<li><a href="https://www.amazon.com/ggplot2-Elegant-Graphics-Data-Analysis/dp/331924275X">ggplot book</a></li>
<li>Basically anything by Hadley Wickham is the future of nice stuff for R.</li>
</ul>
<h1 id="getting-image-files-ready-for-publication.">Getting image files ready for publication.</h1>
<p>There are a lot of ways to do this! Here’s one that works well.</p>
<h2 id="background">Background</h2>
<ul>
<li>R does not make “true” pdf files!! Rather, it generates a wrapper around some other form of graphic file. In our experience, pdf generated from R raise red flags at journals like PLoS.</li>
</ul>
<p>So, here is what we do:</p>
<ol style="list-style-type: decimal">
<li>Save graphics as 600dpi TIFF:</li>
</ol>
<pre class="sourceCode r"><code class="sourceCode r"><span class="kw">tiff</span>(<span class="st">'plot.tiff'</span>,<span class="dt">height=</span>x,<span class="dt">width=</span>y,<span class="dt">res=</span><span class="dv">600</span>)</code></pre>
<p>This makes a really big file!</p>
<ol start="2" style="list-style-type: decimal">
<li>Use <a href="https://www.imagemagick.org/">ImageMagick</a> to convert to smaller tiff:</li>
</ol>
<pre class="sh"><code>convert plot.tiff -set colorspace RGB -layers flatten -alpha off \
-compress lzw -depth 8 -density 600 -adaptive-resize 4500x2400 plot.compressed.tif</code></pre>
<ol start="3" style="list-style-type: decimal">
<li>Use ImageMagick again to make a final pdf:</li>
</ol>
<pre class="sh"><code>convert plot.compressed.tif plot.compressed.pdf</code></pre>
<p>We have a shell script online to automate the process. Get it <a href="https://github.com/ThorntonLab/ThorntonLabToolkit">here</a>.</p>
</body>
</html>