Skip to content

Commit a92679c

Browse files
committed
experiment with ggplot
1 parent 53accc1 commit a92679c

File tree

6 files changed

+45
-4
lines changed

6 files changed

+45
-4
lines changed

article2-example/svm-article2-example.Rmd

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ header-includes:
3838

3939
```{r setup, include=FALSE}
4040
knitr::opts_chunk$set(echo = TRUE)
41+
library(tidyverse)
42+
library(stevemisc)
4143
```
4244

4345

@@ -68,6 +70,18 @@ This is an R Markdown document. Markdown is a simple formatting syntax for autho
6870

6971
\kant[19-23]
7072

73+
```{r, echo=F, fig.cap = "A Simple ggplot with the mtcars Data in R", message=F, fig.width=8}
74+
75+
mtcars %>%
76+
ggplot(.,aes(wt, mpg)) + geom_point() +
77+
theme_steve_web() +
78+
geom_smooth(method="lm") +
79+
labs(caption = "Data: 1974 Motor Trend US magazine",
80+
x = "Weight (1,000 Pounds)",
81+
y = "(U.S.) Miles per Gallon")
82+
83+
```
84+
7185
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
7286

7387
```{r cars}
@@ -91,6 +105,10 @@ Note that the `echo = FALSE` parameter was added to the code chunk to prevent pr
91105

92106
\kant[25-35]
93107

108+
```{r}
109+
plot(mtcars)
110+
```
111+
94112
# Conclusion
95113

96114
\kant[36-40]
107 KB
Binary file not shown.

article2-example/svm-article2-example.tex

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,7 @@
179179
% See: https://tex.stackexchange.com/questions/2275/keeping-tables-figures-close-to-where-they-are-mentioned
180180
\usepackage[section]{placeins}
181181

182-
\usepackage{longtable}
183-
\LTcapwidth=.95\textwidth
184-
\linespread{1.05}
185-
\usepackage{hyperref}
182+
186183

187184
\makeatletter
188185
\@ifpackageloaded{hyperref}{}{%
@@ -217,12 +214,24 @@
217214

218215

219216

217+
% This will better treat References as a section when using natbib
220218
% https://tex.stackexchange.com/questions/49962/bibliography-title-fontsize-problem-with-bibtex-and-the-natbib-package
221219
\renewcommand\bibsection{%
222220
\section*{References}%
223221
\markboth{\MakeUppercase{\refname}}{\MakeUppercase{\refname}}%
224222
}%
225223

224+
% set default figure placement to htbp
225+
\makeatletter
226+
\def\fps@figure{htbp}
227+
\makeatother
228+
229+
230+
231+
\usepackage{longtable}
232+
\LTcapwidth=.95\textwidth
233+
\linespread{1.05}
234+
\usepackage{hyperref}
226235
\begin{document}
227236

228237
% \textsf{\textbf{This is sans-serif bold text.}}
@@ -332,6 +341,12 @@ \subsection{Another Subsection}\label{another-subsection}}
332341

333342
\kant[19-23]
334343

344+
\begin{figure}
345+
\centering
346+
\includegraphics{svm-article2-example_files/figure-latex/unnamed-chunk-1-1.pdf}
347+
\caption{A Simple ggplot with the mtcars Data in R}
348+
\end{figure}
349+
335350
When you click the \textbf{Knit} button a document will be generated
336351
that includes both content as well as the output of any embedded R code
337352
chunks within the document. You can embed an R code chunk like this:
@@ -369,6 +384,14 @@ \subsection{Including Plots}\label{including-plots}}
369384

370385
\kant[25-35]
371386

387+
\begin{Shaded}
388+
\begin{Highlighting}[]
389+
\KeywordTok{plot}\NormalTok{(mtcars)}
390+
\end{Highlighting}
391+
\end{Shaded}
392+
393+
\includegraphics{svm-article2-example_files/figure-latex/unnamed-chunk-2-1.pdf}
394+
372395
\hypertarget{conclusion}{%
373396
\section{Conclusion}\label{conclusion}}
374397

Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)