-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathggstat_violino_cisalhamento.R
75 lines (66 loc) · 1.98 KB
/
ggstat_violino_cisalhamento.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
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
#carregando dados
cisalhamento <- read.table(
"C:/Users/Annie de Lima/Downloads/Estatística/stat_debs/cisalhamento.txt",
header = T)
Especie <- cisalhamento$especie
MOR <- cisalhamento$MOR2
dados <- data.frame(Especie,MOR)
plt <- ggbetweenstats(
data = dados,
x = Especie,
y = MOR
)
plt <- plt +
# Add labels and title
labs(
x = "Espécies",
y = "MOR (MPa)",
title = "Distribuição de tensão de cisalhamento"
) +
# Customizations
theme(
# This is the new default font in the plot
text = element_text(family = "Times", size = 8, color = "black"),
plot.title = element_text(
family = "Times",
size = 15,
face = "bold",
color = "#2a475e"
),
# Statistical annotations below the main title
plot.subtitle = element_text(
family = "Times",
size = 12,
face = "bold",
color="#1b2838"
),
plot.title.position = "plot", # slightly different from default
axis.text = element_text(size = 10, color = "black"),
axis.title = element_text(size = 12)
)
# 1. Remove axis ticks
# 2. Change default color of the axis lines with a lighter one
# 3. Remove most reference lines, only keep the major horizontal ones.
# This reduces clutter, while keeping the reference for the variable
# being compared.
# 4. Set the panel and the background fill to the same light color.
plt <- plt +
theme(
axis.ticks = element_blank(),
axis.line = element_line(colour = "grey50"),
panel.grid = element_line(color = "#b4aea9"),
panel.grid.minor = element_blank(),
panel.grid.major.x = element_blank(),
panel.grid.major.y = element_line(linetype = "dashed"),
panel.background = element_rect(fill = "#ffffff", color = "#ffffff"),
plot.background = element_rect(fill = "#ffffff", color = "#ffffff")
)
plt
# Saving
ggsave(
filename = "cisalhamento.png",
plot = plt,
width = 8,
height = 8,
device = "png"
)