-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSec-Plotting.Rnw
101 lines (87 loc) · 2.57 KB
/
Sec-Plotting.Rnw
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
\section{Plotting}
<<env, echo=FALSE, massage = FALSE>>=
suppressPackageStartupMessages(library(Biobase))
data(sample.ExpressionSet)
@
\begin{frame}
\begin{itemize}
\item Scatterplots with \Rfunction{plot}
\item Boxplots with \Rfunction{boxplot}
\item Barplots with \Rfunction{barplot}
\item Histograms with \Rfunction{hist}
\item \Rfunction{smoothScatter}
\end{itemize}
\end{frame}
\begin{frame}[fragile]
<<plotcode, eval = FALSE, tidy = FALSE>>=
plot(exprs(sample.ExpressionSet[, 1]),
exprs(sample.ExpressionSet[, 2]),
log = "xy",
xlab = sampleNames(sample.ExpressionSet)[1],
ylab = sampleNames(sample.ExpressionSet)[2])
abline(0, 1)
grid()
@
\end{frame}
\begin{frame}[fragile]
\scriptsize
<<label=plotfig1, echo=FALSE, fig.width=5, fig.height=4, tidy=FALSE, warning = FALSE>>=
plot(exprs(sample.ExpressionSet[, 1]),
exprs(sample.ExpressionSet[, 2]),
log = "xy",
xlab = sampleNames(sample.ExpressionSet)[1],
ylab = sampleNames(sample.ExpressionSet)[2])
abline(0, 1)
grid()
@
\end{frame}
\begin{frame}[fragile]
To create subplots, one can use \Rfunction{par(mfrow = c(2,2))}, \Rfunction{layout}, or (for scatterplots)
<<plotcode0, eval = FALSE, tidy = FALSE>>=
pairs(log2(exprs(sample.ExpressionSet)[, 1:4]),
pch = 19,
col = "#0000FF20")
@
\end{frame}
\begin{frame}[fragile]
\scriptsize
<<label=plotfig2,echo=FALSE,fig.width=3.5,fig.height=3.5,tidy=FALSE, warning = FALSE>>=
pairs(log2(exprs(sample.ExpressionSet)[, 1:3]),
pch = 19,
col = "#0000FF20")
@
\end{frame}
\begin{frame}[fragile]
<<plotcode1, eval = FALSE>>=
boxplot(log2(exprs(sample.ExpressionSet)))
@
\end{frame}
\begin{frame}[fragile]
\scriptsize
<<label=plotfig3,echo=FALSE,fig.width=5,fig.height=4,tidy=FALSE>>=
boxplot(log2(exprs(sample.ExpressionSet)))
@
\end{frame}
%% \begin{frame}[fragile]
%% <<plotcode2, eval = FALSE>>=
%% smoothScatter(log2(exprs(sample.ExpressionSet)[, 1:2]))
%% @
%% \end{frame}
\begin{frame}[fragile]
\scriptsize
<<label=plotfig4,echo=TRUE,fig.width=5,fig.height=4,tidy=FALSE, warning = FALSE, message = FALSE>>=
smoothScatter(log2(exprs(sample.ExpressionSet)[, 1:2]))
@
\end{frame}
\begin{frame}
\begin{block}{References}
We have not covered \Rpackage{lattice} and \Rpackage{ggplot2}.
\end{block}
\begin{block}{References}
\begin{itemize}
\item \url{http://gallery.r-enthusiasts.com/allgraph.php}
\item R Graphics manual: \url{http://rgm3.lab.nig.ac.jp/RGM/r_image_list}
\item \url{http://www.cookbook-r.com/Graphs/} (ggplot2)
\end{itemize}
\end{block}
\end{frame}