-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
150 lines (107 loc) · 2.99 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# waRhol
<!-- badges: start -->
<!-- badges: end -->
waRhol is an R package containing colour palettes inspired by the paintings of Andy Warhol. It can be directly integrated with ggplot and base R plotting.
## Installation
You can install the development version of waRhol from [GitHub](https://github.com/) with:
```{r message=FALSE}
# install.packages("devtools")
devtools::install_github("alexskeels/waRhol")
```
## Palettes
Here are the palettes:
```{r}
library(waRhol)
library(ggplot2)
pal_names <- names(warhol_palettes)
par(mfrow=c(length(warhol_palettes)/2, 2), lheight = 2, mar=rep(1, 4), adj = 0)
for (i in 1:length(warhol_palettes)){
viz_palette(warhol_palettes[[i]], pal_names[i])
}
```
## inspiration
![skull_76_1](files/Warhol_Skull_1976.jpg)
```{r}
viz_palette(warhol_palettes[["skull_76_1"]])
```
![skull_76_2](files/Warhol_Skull.PNG)
```{r}
viz_palette(warhol_palettes[["skull_76_2"]])
```
![skull_77](files/Warhol_Skull_1977.jpg)
```{r}
viz_palette(warhol_palettes[["skull_77"]])
```
![skull_86](files/Warhol_Skull_1986.PNG)
```{r}
viz_palette(warhol_palettes[["skull_86"]])
```
![marilyn_orange_62](files/Warhol_Marilyn_Orange_1962.PNG)
```{r}
viz_palette(warhol_palettes[["marilyn_orange_62"]])
```
![marilyn_green_62](files/Warhol_Marilyn_Green_1962.PNG)
```{r}
viz_palette(warhol_palettes[["marilyn_green_62"]])
```
![marilyn_67](files/Warhol_Marilyn_1967.jpg)
```{r}
viz_palette(warhol_palettes[["marilyn_67"]])
```
![camo_87](files/Warhol_Camoflague_1987.jpg)
```{r}
viz_palette(warhol_palettes[["camo_87_1"]])
viz_palette(warhol_palettes[["camo_87_2"]])
viz_palette(warhol_palettes[["camo_87_3"]])
viz_palette(warhol_palettes[["camo_87_4"]])
viz_palette(warhol_palettes[["camo_87_5"]])
```
![bighorn_ram_83](files/Warhol_BighornRam_1983.PNG)
```{r}
viz_palette(warhol_palettes[["bighorn_ram_83"]])
```
![basquiat_85](files/Warhol_Basquiat_1985.jpg)
```{r}
viz_palette(warhol_palettes[["basquiat_85"]])
```
![the_big_c_86](files/Warhol_LastSupper_1986.jpg)
```{r}
viz_palette(warhol_palettes[["the_big_c_86"]])
```
## Useage examples
Example of a discrete palette in ggplot
```{r}
ggplot(diamonds) +
geom_bar(aes(x = cut, fill = clarity)) +
theme_light()+
scale_fill_warhol(palette="bighorn_ram_83")
```
Example of a continuous palette in ggplot
```{r}
ggplot(mtcars, aes(mpg, wt)) +
geom_point(aes(colour = hp), size=2) +
scale_colour_warhol(palette="camo_87_1", discrete = FALSE)+
theme_light()
ggplot(mtcars, aes(mpg, wt)) +
geom_point(aes(colour = hp), size=2) +
scale_colour_warhol(palette="marilyn_orange_62", discrete = FALSE)+
theme_light()
```
Example of a continuous palette in base R
```{r}
par(mfrow=c(1,1))
pal <- colorRampPalette(warhol_palettes[["skull_76_2"]])
image(volcano, col = pal(20))
```