-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.Rmd
134 lines (114 loc) · 3.64 KB
/
README.Rmd
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
---
title: plot_it function
author: |
| Matthew Malishev^1^*
|
| _^1^ Department of Biology, Emory University, 1510 Clifton Road NE, Atlanta, GA, USA, 30322_
#bibliography:/Users/malishev/Documents/Melbourne Uni/Thesis_2016/library.bib
fontsize: 10
geometry: margin=1in
documentclass: article
linkcolor: pink
urlcolor: blue
citecolor: red
always_allow_html: yes
output:
md_document:
variant: markdown_github
pdf_document:
includes:
in_header: # add .tex file with header content
highlight: tango
template: null
toc: yes
toc_depth: 4
number_sections: false
fig_width: 4
fig_height: 5
fig_caption: true
df_print: tibble
citation_package: biblatex # natbib
latex_engine: xelatex #pdflatex # lualatex
keep_tex: true # keep .tex file in dir
html_document:
highlight: tango
code_folding: hide
toc: yes
toc_depth: 4
number_sections: no
toc_float: yes
word_document:
highlight: tango
keep_md: yes
pandoc_args: --smart
#reference: mystyles.docx
toc: yes
toc_depth: 4
inludes:
before_body: before_body.tex
subtitle:
tags:
- nothing
- nothingness
params:
dir: "/Users/malishev/Documents/Melbourne Uni/Programs/R code/plot_it"
date: !r Sys.Date()
version: !r getRversion()
email: "[email protected]"
doi: https://github.com/darwinanddavis/plot_it
classoption: portrait
vignette: >
%\VignetteIndexEntry{plot_it}
%\VignetteEncoding{UTF-8}
%\VignetteEngine{knitr::rmarkdown}
---
<!-- This file is edited in README.Rmd -->
```{r, set-options, echo = FALSE, cache = FALSE}
options(width=100)
knitr::opts_chunk$set(
eval = F, # run all code
# echo = FALSE, # show code chunks in output
comment = "",
tidy.opts=list(width.cutoff=100), # set width of code chunks in output
tidy=TRUE, # make output as tidy
message = FALSE, # mask all messages
warning = FALSE, # mask all warnings
size="small" # set code chunk size
)
# https://github.com/ucb-stat133/stat133-fall-2016/blob/master/hws/hw02-tables-ggplot.Rmd
knitr::opts_knit$set(root.dir=paste0(params$dir,"/")) # set working dir
```
# `plot_it` function
`R` version: `r params$version`
\newpage
## Overview
Plotting function for switching between manuscript-ready and presentation style plots in `R`.
### Directions
:one: In your `R` file, run the following code.
```{r}
require(RCurl)
script <- getURL("https://raw.githubusercontent.com/darwinanddavis/plot_it/master/plot_it.R", ssl.verifypeer = FALSE)
eval(parse(text = script))
```
:two: Use the following function to set your plotting parameters.
- Specify if plotting for a manuscript or seminar (0/1)
- Specify background colour (char)
- Specify plotting colour palette 1 from RColorBrewer (char)
- Specify plotting colour palette 2 from RColorBrewer (char)
- Specify alpha transparency for plot points (int)
- Specify font family for plot text (char)
```{r}
require(RColorBrewer)
display.brewer.all()
# Set global plotting parameters
cat("plot_it( \n0 for presentation, 1 for manuscript, \nset colour for background, \nset colour palette 1. use 'display.brewer.all()', \nset colour palette 2. use 'display.brewer.all()', \nset alpha for colour transperancy, \nset font style \n)")
plot_it(0,"blue","Spectral","Greens",1,"mono") # set plot function params
plot_it_gg("black","white") # specify background and foreground colours
```
:three: Make cool graphs.
## Maintainer
**Matt Malishev**
- :mag: [Website](https://www.researchgate.net/profile/Matt_Malishev)
- :bird: [@darwinanddavis](https://twitter.com/darwinanddavis)
- :email: matthew.malishev [at] gmail.com
\