-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathColoring.Rmd
More file actions
79 lines (58 loc) · 1.49 KB
/
Coloring.Rmd
File metadata and controls
79 lines (58 loc) · 1.49 KB
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
---
title: "Colors in R"
author: "Abid Ali Shaikh"
date: "12/29/2021"
output:
html_document:
code_folding: show
theme:
bg: "#202123"
fg: "#B8BCC2"
primary: "#EA80FC"
base_font:
google: Prompt
heading_font:
google: Proza Libre
version: 3
---
## R Markdown
```{r setup}
knitr::opts_chunk$set()
if (requireNamespace("thematic"))
thematic::thematic_rmd(font = "auto")
```
```{css}
pre code {
font-size: 14px; /* Adjust the font size as desired */
}
```
## Themed Plots {.tabset .tabset-pills}
### Color list
```{r}
freq_colors <- c("black", "white", "red", "blue", "green", "yellow", "orange", "purple", "pink", "brown", "gray", "cyan", "magenta", "turquoise", "lavender", "olive", "maroon", "teal", "navy", "beige")
d1<- data.frame(table(gsub('[1-9]','',colors())))
d1[order(d1$Freq,decreasing = T),]
```
### Rainbow Colors
```{r}
par(bg="#202123")
par(col.axis="#B8BCC2")
barplot(seq(1,20,1), col=rainbow(20))
```
### colorRampPallete
```{r}
par(col.axis="#B8BCC2")
d <- colorRampPalette(c('yellow','green','red','brown'))
d(20)
barplot(seq(1,20,1),col=d(20))
barplot(seq(1,20,1),col=grey.colors(20))
```
### ggplot
```{r coloring2}
library(ggplot2)
par(col.axis="#B8BCC2")
s <- read.table('crawley/scatter1.txt',header=T)
g1 <- ggplot(s, aes(xv,ys))+geom_smooth(method='lm',size=3,colour='blue')
g2 <- g1+geom_point(colour='skyblue',alpha=1/2)
plot(g2)
```