-
Notifications
You must be signed in to change notification settings - Fork 2
/
styleguide.R
33 lines (31 loc) · 1.94 KB
/
styleguide.R
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
#### Most Recent Debate ####
# Step 0: HODP Theme
if (!require('dplyr')) install.packages('dplyr'); library(dplyr)
if (!require('ggplot2')) install.packages('ggplot2'); library(ggplot2)
if (!require('hrbrthemes')) install.packages('hrbrthemes'); library(hrbrthemes)
if (!require('magick')) install.packages('magick'); library(magick)
if (!require('plotly')) install.packages('plotly'); library(plotly)
logo <- image_read("logo.png")
# Legend: https://stackoverflow.com/questions/14622421/how-to-change-legend-title-in-ggplot
monochrome <- c('#760000', '#BE1E26', '#D84742', '#FF6B61', '#FF9586')
primary <- c('#EE3838', '#FA9E1C', '#78C4D4', '#4B5973', '#E2DDDB')
sidebysidebarplot <- c("#ef3e3e", "#2c3e50")
theme_hodp <- function () {
theme_classic(base_size=12, base_family="Helvetica") %+replace%
theme(
panel.background = element_rect(fill="#F2F2F2", colour=NA),
plot.background = element_rect(fill="#F2F2F2", colour="#d3d3d3"),
legend.background = element_rect(fill="transparent", colour=NA),
legend.key = element_rect(fill="transparent", colour=NA),
plot.title = element_text(size=24, family="Helvetica", face = "bold", margin = margin(t = 0, r = 0, b = 10, l = 0)),
plot.subtitle = element_text(size=18, family="Helvetica", color="#717171", face = "italic", margin = margin(t = 0, r = 0, b = 10, l = 0)),
plot.caption = element_text(size=8, family="Helvetica", hjust = 1),
axis.text.x =element_text(size=10, family="Helvetica"),
axis.title.x =element_text(size=14, family="Helvetica", margin = margin(t = 10, r = 0, b = 0, l = 0), face = "bold"),
axis.title.y = element_text(margin = margin(t = 0, r = 10, b = 0, l = 0), size=14, family="Helvetica", angle=90, face ='bold'),
legend.title=element_text(size=10, family="Helvetica"),
legend.text=element_text(size=10, family="Helvetica"),
legend.position = "bottom",
axis.ticks = element_blank()
)
}