-
Notifications
You must be signed in to change notification settings - Fork 2
/
README.Rmd
98 lines (79 loc) · 3.03 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
---
title: "*spaceMovie* color palette generator"
output:
html_document:
keep_md: TRUE
---
```{r, echo = FALSE}
knitr::opts_chunk$set(
echo = TRUE,
fig.align = "center",
fig.path = "figure/"
)
```
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active)
[![Build Status](https://travis-ci.org/butterflyology/spaceMovie.svg?branch=master)](https://travis-ci.org/butterflyology/spaceMovie)
Please cite this package if you use it:
[![DOI](https://zenodo.org/badge/78565513.svg)](https://zenodo.org/badge/latestdoi/78565513)
The colors used in this package were all found using publically available sources, many of them from LucasArts themselves. For example:
- [Rebels](http://www.starwars.com/news/star-wars-rebels-costume-color-guide-for-padawans-twileks-and-more)
- [Imperials](http://www.starwars.com/news/star-wars-rebels-costume-color-guide-for-imperials)
Other colors gleaned from various sources:
- Colors from Episodes 1-7 were gleaned from [Baptiste](http://www.fubiz.net/en/2015/04/20/the-colors-of-star-wars-palettes/) and [Anthony Caravaggi](http://www.arcaravaggi.co.uk)
- Colors for the "Main" list were gleaned from [theforce.net](http://www.theforce.net/fanfilms/postproduction/crawl/opening.asp)
If you would like to contribute to the package, please submit a PR with **documentation for color provenance**.
Kartik Ram's [Wes Anderson](https://github.com/karthik/wesanderson) color palette inspired me to create this package and I followed his implementation for consistency.
### Installation
```{r install, eval = FALSE}
devtools::install_github("butterflyology/spaceMovie")
```
### Usage
```{r usage}
library("spaceMovie")
```
#### Scatterplot with the "Chopper" palette
```{r chopper}
library("ggplot2")
ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) +
theme_bw() +
geom_point(size = 3) +
scale_color_manual(values = SW_palette("Chopper")) +
labs(y = "Sepal width", x = "Sepal length") +
theme(legend.text = element_text(face = "italic"))
```
#### The Empire Strikes Back
```{r ANH, fig.height = 1}
SW_palette("TESB")
```
#### "Zeb"
```{r Zeb, fig.height = 1}
SW_palette("Zeb")
```
#### "Sabine"
```{r Sabine, fig.height = 1}
SW_palette("Sabine", n = 3)
```
#### "Boba"
```{r Boba, fig.height = 1}
SW_palette("Boba", n = 21, type = "continuous")
```
#### Stacked barplot using "Main"
```{r Main}
qplot(factor(cyl), data = mtcars, geom = "bar", fill=factor(vs)) +
scale_fill_manual(values = SW_palette("Main"))
```
#### A Boba Fett volcano!
```{r Boba_volcano}
SW_colors_1 <- SW_palette("Boba", 21, type = "continuous")
image(volcano, col = SW_colors_1, las = 1)
```
#### Heat map
```{r Heat}
SW_colors_2 <- SW_palette("Hera", 100, type = "continuous")
ggplot(heatmap, aes(x = X2, y = X1, fill = value)) +
geom_tile() +
scale_fill_gradientn(colours = SW_colors_2) +
scale_x_discrete(expand = c(0, 0)) +
scale_y_discrete(expand = c(0, 0)) +
coord_equal()
```