Improved graphics

This commit is contained in:
Philipp Homan yoga ubuntu 17.10 2018-04-02 20:00:34 -04:00
parent 0a4af13260
commit 3be5f64c46
8 changed files with 166 additions and 117 deletions

BIN
src/3.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

BIN
src/4l.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
src/4r.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -106,7 +106,7 @@
\leavevmode
\begin{columns}[t,onlytextwidth]
\column{.87\textwidth}
\begin{beamercolorbox}[wd=\columnwidth, leftskip=2.0cm]{headline}
\begin{beamercolorbox}[wd=\columnwidth, leftskip=2.0cm, ht=11.55cm]{headline}
% \vskip1.5cm
% \centering
\vskip7.6ex

View File

@ -1,6 +1,5 @@
#+startup: beamer
#+TITLE: A scientific poster entirely written in org-mode
#+TITLE: using GNU emacs and the beamer library
#+TITLE: Using org-mode to produce scientific posters
* Preamble :ignore:
** General comments :ignore:
# ----------------------------------------------------------------------
@ -138,15 +137,14 @@
:BEAMER_env: fullframe
:END:
** Code :ignore:
# Babel code can go here to populate the poster with dynamic output from
# statistical calculations
# Babel code can go here to populate the poster with dynamic output
** Left column :BMCOL:
** Left column :BMCOL:
:PROPERTIES:
:BEAMER_col: 0.45
:BEAMER_opt: [t]
:END:
*** Background :B_block:
*** Background :B_block:
:PROPERTIES:
:BEAMER_env: block
:END:
@ -168,17 +166,17 @@
:END:
#+NAME: code1
#+BEGIN_SRC R :session :export both :results output graphics :file 3.png
x <- rnorm(100, 0, 1)
hist(x, col="gray")
#+BEGIN_SRC R :file 3.png :session :exports both :results graphics
set.seed(20180402)
x1 <- rnorm(100, 0, 1)
x2 <- rnorm(100, 0.5, 1)
hist(x1, col="red")
hist(x2, col="blue", add=TRUE)
#+END_SRC
#+RESULTS: code1
[[file:3.png]]
#+NAME: figcode1
#+CAPTION: This is the output.
#+RESULTS: code1
[[file:3.png]]
*** Inline code and tables :B_block:
@ -188,46 +186,51 @@ hist(x, col="gray")
- In addition to inline code, we can also produce tables
- Tables are very powerful in org-mode, they even include spreadsheet
capabilities
- Some code to process the vector from above to make a table out of its
summary could look like this, which would result in a little table
(Table [[tabcode2]]) :
- Some code to process the first vector from above to make a table out
of its summary could look like this, which would result in a little
table (Table [[tabcode2]]) :
**** Block
:PROPERTIES:
:BEAMER_col: 0.48
:BEAMER_col: 0.88
:BEAMER_opt: [T]
:END:
#+NAME: code2
#+BEGIN_SRC R :session :exports both :results value :colnames yes :cache yes
m <- round(mean(x), 2)
s <- round(sd(x), 2)
data.frame(Mean=m, SD=s)
library(broom)
library(dplyr)
t1 <- tidy(round(summary(x1), 2))
t2 <- tidy(round(summary(x2), 2))
# This will export as a table
rbind(t1, t2) %>%
mutate(name=c("x1", "x2"))
#+END_SRC
\vspace{2cm}
#+CAPTION: A table.
#+CAPTION: A table summarizing the two distributions.
#+NAME: tabcode2
#+RESULTS[31e41e0f8cc2db2fb601af81fe4f5e218ea48f57]: code2
|-------+------|
| Mean | SD |
|-------+------|
| -0.07 | 0.97 |
|-------+------|
#+RESULTS[9d0ec7348265a5cb6de39440ff06a8dbb8e5ecf1]: code2
|---------+-------+--------+------+------+---------+------|
| minimum | q1 | median | mean | q3 | maximum | name |
|---------+-------+--------+------+------+---------+------|
| -2.29 | -0.49 | 0.11 | 0.14 | 0.8 | 2.47 | x1 |
| -2.17 | -0.45 | 0.07 | 0.13 | 0.85 | 2.23 | x2 |
|---------+-------+--------+------+------+---------+------|
** Right column :BMCOL:
** Right column :BMCOL:
:PROPERTIES:
:BEAMER_col: 0.45
:BEAMER_opt: [t]
:END:
*** Graphics :B_block:
*** Graphics :B_block:
:PROPERTIES:
:BEAMER_env: block
:END:
- Of course we can also include graphics
- Here, we use shell scripting to grab an image with curl from the
- We can use shell scripting to grab an image with curl from the
internet (Fig. [[figcode3]]):
**** Block
@ -239,6 +242,7 @@ data.frame(Mean=m, SD=s)
\footnotesize
#+NAME: code3
#+BEGIN_SRC bash :exports both :file emacs.png
# Download emacs icon from gnu.org
curl -0 https://www.gnu.org/software/emacs/images/emacs.png
#+END_SRC
\normalsize
@ -251,12 +255,14 @@ curl -0 https://www.gnu.org/software/emacs/images/emacs.png
#+RESULTS: code3
[[file:emacs.png]]
*** Math :B_block:
*** Math :B_block:
:PROPERTIES:
:BEAMER_env: block
:END:
- We can easily include math:
- We can easily include math
- For example, let's describe how to compute the distance between the
two simulated distributions $x1$ and $x2$ from before:
**** Block
:PROPERTIES:
@ -284,7 +290,7 @@ derived as follows:
\DKLPQ{P}{Q}{,} = \sumin \Big(\Xoi{P} \log \frakPQ{P}{Q} + \Xoi{Q} \log \frakPQ{Q}{P} \Big).
\end{align}
*** Columns :B_block:
*** Columns :B_block:
:PROPERTIES:
:BEAMER_env: block
:END:
@ -295,11 +301,19 @@ derived as follows:
:BEAMER_opt: [T]
:END:
\captionsetup{justification=justified,width=.8\linewidth}
#+NAME: figge
#+CAPTION: *This is the left figure of a two-column block*
#+ATTR_LATEX: :width 0.9\textwidth :options page=3
[[file:org-mode-poster-4.png]]
#+NAME: codeleft
#+BEGIN_SRC R :file 4l.png :session org_org :exports results :results graphics
d1 <- density(x1)
plot(d1, col="red", lwd=3)
#+END_SRC
\captionsetup{justification=justified,width=.85\linewidth}
#+NAME: figcodeleft
#+CAPTION: This is the left figure of a two-column block, showing
#+CAPTION: the density of $x1$.
#+RESULTS: codeleft
[[file:4l.png]]
**** Right
:PROPERTIES:
@ -307,16 +321,22 @@ derived as follows:
:BEAMER_opt: [T]
:END:
\captionsetup{justification=justified,width=.8\linewidth}
#+NAME: figclus
#+CAPTION: *This is the right figure.*
#+ATTR_LATEX: :width 0.9\textwidth :options page=9
[[file:org-mode-poster-4.png]]
#+NAME: coderight
#+BEGIN_SRC R :file 4r.png :session org_org :exports results :results graphics
d2 <- density(x2)
plot(d2, col="blue", lwd=3)
#+END_SRC
*** Conclusions :B_block:
\captionsetup{justification=justified,width=.85\linewidth}
#+NAME: figcoderight
#+CAPTION: This is the right figure. It shows the density of $x2$.
#+RESULTS: coderight
[[file:4r.png]]
*** Conclusions :B_block:
:PROPERTIES:
:BEAMER_env: block
:END:
- This little example is meant to show how incredibly versatile
org-mode is
- One can now produce scientific posters with a simple text editor
- Scientific posters can be produced with a simple text editor

Binary file not shown.

View File

@ -1,4 +1,4 @@
% Created 2018-04-02 Mon 18:38
% Created 2018-04-02 Mon 19:58
% Intended LaTeX compiler: pdflatex
\documentclass[final]{beamer}
\usetheme{ph}
@ -33,11 +33,11 @@ Philipp Homan$^{1}$,
\normalsize{Hempstead, NY}
}
\usetheme{default}
\date{2018-04-02 18:38}
\title{A scientific poster entirely written in org-mode using GNU emacs and the beamer library}
\date{2018-04-02 19:58}
\title{Using org-mode to produce scientific posters}
\begin{document}
\begin{frame}[fragile,label={sec:org727f6f5}]{}
\begin{frame}[fragile,label={sec:org10a116a}]{}
\begin{columns}
\begin{column}[t]{0.45\columnwidth}
\begin{block}{Background}
@ -51,21 +51,23 @@ org-mode syntax
code, graphs and numbers from inline code in languages such as R,
python, Matlab and even shell scripting
\item Inline code would look like this, which will produce a graph
(Fig. \ref{fig:orgaca79ae}):
(Fig. \ref{fig:org8cce396}):
\end{itemize}
\begin{columns}
\begin{column}[T]{0.48\columnwidth}
\begin{minted}[linenos=true]{r}
x <- rnorm(100, 0, 1)
hist(x, col="gray")
set.seed(20180402)
x1 <- rnorm(100, 0, 1)
x2 <- rnorm(100, 0.5, 1)
hist(x1, col="red")
hist(x2, col="blue", add=TRUE)
\end{minted}
\begin{figure}[htbp]
\centering
\includegraphics[width=.9\linewidth]{3.png}
\caption{\label{fig:orgaca79ae}
\caption{\label{fig:org8cce396}
This is the output.}
\end{figure}
\end{column}
@ -77,30 +79,38 @@ This is the output.}
\item In addition to inline code, we can also produce tables
\item Tables are very powerful in org-mode, they even include spreadsheet
capabilities
\item Some code to process the vector from above to make a table out of its
summary could look like this, which would result in a little table
(Table \ref{tab:org6921627}) :
\item Some code to process the first vector from above to make a table out
of its summary could look like this, which would result in a little
table (Table \ref{tab:orgfdd29a9}) :
\end{itemize}
\begin{columns}
\begin{column}[T]{0.48\columnwidth}
\begin{column}[T]{0.88\columnwidth}
\begin{minted}[linenos=true]{r}
m <- round(mean(x), 2)
s <- round(sd(x), 2)
data.frame(Mean=m, SD=s)
library(broom)
library(dplyr)
t1 <- tidy(round(summary(x1), 2))
t2 <- tidy(round(summary(x2), 2))
# This will export as a table
rbind(t1, t2) %>%
mutate(name=c("x1", "x2"))
\end{minted}
\vspace{2cm}
\begin{table}[htbp]
\centering
\begin{tabular}{rr}
Mean & SD\\
\begin{tabular}{rrrrrrl}
\hline
minimum & q1 & median & mean & q3 & maximum & name\\
\hline
-2.29 & -0.49 & 0.11 & 0.14 & 0.8 & 2.47 & x1\\
-2.17 & -0.45 & 0.07 & 0.13 & 0.85 & 2.23 & x2\\
\hline
0.07 & 0.98\\
\end{tabular}
\caption{\label{tab:org6921627}
A table.}
\caption{\label{tab:orgfdd29a9}
A table summarizing the two distributions.}
\end{table}
\end{column}
@ -111,15 +121,15 @@ A table.}
\begin{column}[t]{0.45\columnwidth}
\begin{block}{Graphics}
\begin{itemize}
\item Of course we can also include graphics
\item Here, we use shell scripting to grab an image with curl from the
internet (Fig. \ref{fig:orgf35b3ea}):
\item We can use shell scripting to grab an image with curl from the
internet (Fig. \ref{fig:orga373a15}):
\end{itemize}
\begin{columns}
\begin{column}[T]{0.78\columnwidth}
\footnotesize
\begin{minted}[linenos=true]{bash}
# Download emacs icon from gnu.org
curl -0 https://www.gnu.org/software/emacs/images/emacs.png
\end{minted}
\normalsize
@ -129,7 +139,7 @@ curl -0 https://www.gnu.org/software/emacs/images/emacs.png
\begin{figure}[htbp]
\centering
\includegraphics[page=9,width=0.2\textwidth]{emacs.png}
\caption{\label{fig:orgf35b3ea}
\caption{\label{fig:orga373a15}
This is the downloaded image.}
\end{figure}
\end{column}
@ -138,7 +148,9 @@ This is the downloaded image.}
\begin{block}{Math}
\begin{itemize}
\item We can easily include math:
\item We can easily include math
\item For example, let's describe how to compute the distance between the
two simulated distributions \(x1\) and \(x2\) from before:
\end{itemize}
\begin{columns}
@ -169,22 +181,22 @@ derived as follows:
\begin{block}{Columns}
\begin{columns}
\begin{column}[T]{0.48\columnwidth}
\captionsetup{justification=justified,width=.8\linewidth}
\captionsetup{justification=justified,width=.85\linewidth}
\begin{figure}[htbp]
\centering
\includegraphics[page=3,width=0.9\textwidth]{org-mode-poster-4.png}
\caption{\label{fig:org623938b}
\textbf{This is the left figure of a two-column block}}
\includegraphics[width=.9\linewidth]{4l.png}
\caption{\label{fig:orgf47550b}
This is the left figure of a two-column block, showing the density of \(x1\).}
\end{figure}
\end{column}
\begin{column}[T]{0.48\columnwidth}
\captionsetup{justification=justified,width=.8\linewidth}
\captionsetup{justification=justified,width=.85\linewidth}
\begin{figure}[htbp]
\centering
\includegraphics[page=9,width=0.9\textwidth]{org-mode-poster-4.png}
\caption{\label{fig:orgb76a1ef}
\textbf{This is the right figure.}}
\includegraphics[width=.9\linewidth]{4r.png}
\caption{\label{fig:org96112b0}
This is the right figure. It shows the density of \(x2\).}
\end{figure}
\end{column}
\end{columns}
@ -194,7 +206,7 @@ derived as follows:
\begin{itemize}
\item This little example is meant to show how incredibly versatile
org-mode is
\item One can now produce scientific posters with a simple text editor
\item Scientific posters can be produced with a simple text editor
\end{itemize}
\end{block}
\end{column}

View File

@ -1,4 +1,4 @@
% Created 2018-04-02 Mon 18:37
% Created 2018-04-02 Mon 19:58
% Intended LaTeX compiler: pdflatex
\documentclass[final]{beamer}
\usetheme{ph}
@ -33,11 +33,11 @@ Philipp Homan$^{1}$,
\normalsize{Hempstead, NY}
}
\usetheme{default}
\date{2018-04-02 18:37}
\title{A scientific poster entirely written in org-mode using GNU emacs and the beamer library}
\date{2018-04-02 19:58}
\title{Using org-mode to produce scientific posters}
\begin{document}
\begin{frame}[fragile,label={sec:org4b06f5e}]{}
\begin{frame}[fragile,label={sec:org5deb971}]{}
\begin{columns}
\begin{column}[t]{0.45\columnwidth}
\begin{block}{Background}
@ -51,21 +51,23 @@ org-mode syntax
code, graphs and numbers from inline code in languages such as R,
python, Matlab and even shell scripting
\item Inline code would look like this, which will produce a graph
(Fig. \ref{fig:org042638b}):
(Fig. \ref{fig:org71455a2}):
\end{itemize}
\begin{columns}
\begin{column}[T]{0.48\columnwidth}
\begin{minted}[linenos=true]{r}
x <- rnorm(100, 0, 1)
hist(x, col="gray")
set.seet(20180402)
x1 <- rnorm(100, 0, 1)
x2 <- rnorm(100, 0.5, 1)
hist(x1, col="red")
hist(x2, col="blue", add=TRUE)
\end{minted}
\begin{figure}[htbp]
\centering
\includegraphics[width=.9\linewidth]{3.png}
\caption{\label{fig:org042638b}
\caption{\label{fig:org71455a2}
This is the output.}
\end{figure}
\end{column}
@ -77,30 +79,38 @@ This is the output.}
\item In addition to inline code, we can also produce tables
\item Tables are very powerful in org-mode, they even include spreadsheet
capabilities
\item Some code to process the vector from above to make a table out of its
summary could look like this, which would result in a little table
(Table \ref{tab:orge51644d}) :
\item Some code to process the first vector from above to make a table out
of its summary could look like this, which would result in a little
table (Table \ref{tab:orgf4d0fa2}) :
\end{itemize}
\begin{columns}
\begin{column}[T]{0.48\columnwidth}
\begin{column}[T]{0.88\columnwidth}
\begin{minted}[linenos=true]{r}
m <- round(mean(x), 2)
s <- round(sd(x), 2)
data.frame(Mean=m, SD=s)
library(broom)
library(dplyr)
t1 <- tidy(round(summary(x1), 2))
t2 <- tidy(round(summary(x2), 2))
# This will export as a table
rbind(t1, t2) %>%
mutate(name=c("x1", "x2"))
\end{minted}
\vspace{2cm}
\begin{table}[htbp]
\centering
\begin{tabular}{rr}
Mean & SD\\
\begin{tabular}{rrrrrrl}
\hline
minimum & q1 & median & mean & q3 & maximum & name\\
\hline
-2.29 & -0.49 & 0.11 & 0.14 & 0.8 & 2.47 & x1\\
-2.17 & -0.45 & 0.07 & 0.13 & 0.85 & 2.23 & x2\\
\hline
0.23 & 1.07\\
\end{tabular}
\caption{\label{tab:orge51644d}
A table.}
\caption{\label{tab:orgf4d0fa2}
A table summarizing the two distributions.}
\end{table}
\end{column}
@ -111,15 +121,15 @@ A table.}
\begin{column}[t]{0.45\columnwidth}
\begin{block}{Graphics}
\begin{itemize}
\item Of course we can also include graphics
\item Here, we use shell scripting to grab an image with curl from the
internet (Fig. \ref{fig:orga669d9a}):
\item We can use shell scripting to grab an image with curl from the
internet (Fig. \ref{fig:org5863a78}):
\end{itemize}
\begin{columns}
\begin{column}[T]{0.78\columnwidth}
\footnotesize
\begin{minted}[linenos=true]{bash}
# Download emacs icon from gnu.org
curl -0 https://www.gnu.org/software/emacs/images/emacs.png
\end{minted}
\normalsize
@ -129,7 +139,7 @@ curl -0 https://www.gnu.org/software/emacs/images/emacs.png
\begin{figure}[htbp]
\centering
\includegraphics[page=9,width=0.2\textwidth]{emacs.png}
\caption{\label{fig:orga669d9a}
\caption{\label{fig:org5863a78}
This is the downloaded image.}
\end{figure}
\end{column}
@ -138,7 +148,9 @@ This is the downloaded image.}
\begin{block}{Math}
\begin{itemize}
\item We can easily include math:
\item We can easily include math
\item For example, let's describe how to compute the distance between the
two simulated distributions \(x1\) and \(x2\) from before:
\end{itemize}
\begin{columns}
@ -157,6 +169,11 @@ with \(P\) and \(Q\) being two probability distribution functions and \(n\)
the number of sample points. Since \(\DKLPQ{P}{Q}{\|}\) is not equal to
\(\DKLPQ{Q}{P}{\|}\), a symmetric variation of the KL divergence can be
derived as follows:
\begin{align}
\label{eq:KL2}
\DKLPQ{P}{Q}{,} = \sumin \Big(\Xoi{P} \log \frakPQ{P}{Q} + \Xoi{Q} \log \frakPQ{Q}{P} \Big).
\end{align}
\end{column}
\end{columns}
\end{block}
@ -164,22 +181,22 @@ derived as follows:
\begin{block}{Columns}
\begin{columns}
\begin{column}[T]{0.48\columnwidth}
\captionsetup{justification=justified,width=.8\linewidth}
\captionsetup{justification=justified,width=.85\linewidth}
\begin{figure}[htbp]
\centering
\includegraphics[page=3,width=0.9\textwidth]{org-mode-poster-4.png}
\caption{\label{fig:org88ad0c6}
\textbf{This is the left figure of a two-column block}}
\includegraphics[width=.9\linewidth]{4l.png}
\caption{\label{fig:orga83a496}
This is the left figure of a two-column block, showing the density of \(x1\).}
\end{figure}
\end{column}
\begin{column}[T]{0.48\columnwidth}
\captionsetup{justification=justified,width=.8\linewidth}
\captionsetup{justification=justified,width=.85\linewidth}
\begin{figure}[htbp]
\centering
\includegraphics[page=9,width=0.9\textwidth]{org-mode-poster-4.png}
\caption{\label{fig:org9e1f136}
\textbf{This is the right figure.}}
\includegraphics[width=.9\linewidth]{4r.png}
\caption{\label{fig:org63d9981}
This is the right figure. It shows the density of \(x2\).}
\end{figure}
\end{column}
\end{columns}
@ -189,7 +206,7 @@ derived as follows:
\begin{itemize}
\item This little example is meant to show how incredibly versatile
org-mode is
\item One can now produce scientific posters with a simple text editor
\item Scientific posters can be produced with a simple text editor
\end{itemize}
\end{block}
\end{column}