-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWilcox_Classification.R
More file actions
56 lines (44 loc) · 2.5 KB
/
Wilcox_Classification.R
File metadata and controls
56 lines (44 loc) · 2.5 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
setwd("/Users/sapu_a/Desktop/Research/Paper (Bengal Basin)/Dhaka Hydro/")
library(ggplot2)
#Reading excel file
df<-read.csv("Hat_Hydro.csv")
# Create labels for x-axis based on specified ranges
df$xlabels <- cut(df$EC..µs.cm., breaks = c(0, 250, 750, 2250, max(df$EC..µs.cm.)),
labels = c("C1", "C2", "C3", "C4"))
# Create labels for y-axis based on specified ranges
df$ylabels <- cut(df$SAR, breaks = c(0, 10, 18, 26, max(df$SAR)),
labels = c("S1", "S2", "S3", "S4"))
#Sampling no.
df$Sample<-1:15
#Wilcox Classificaiton
ggplot(df, aes(x = df$EC..µs.cm., y = df$SSP))+
#for color
#ggplot(df, aes(x = df$EC..µs.cm., y = df$SAR, color = factor(Sample))) +
geom_point(size = 2) +
#geom_text(aes(label = df$X), nudge_x = 0.01, nudge_y = 0.01) +
labs(x = "EC (µs/cm)", y = "%Na") +
scale_x_continuous(limits = c(0, 15000)) +
scale_y_continuous(limits = c(0, 100)) +
scale_x_log10(breaks = c(750, 2000, 3000), limits = c(100, 15000))+
#geom_vline(xintercept = c(750, 2250,3000), color = "black", linetype = "solid", size = 1)+
geom_text(aes(x = df$EC..µs.cm., y = df$SSP, label = df$Sample), size = 3, vjust = 1.5, hjust = 0.5) +
#scale_color_manual(values = c("#CC79A7", "#D55E00", "#0072B2", "#E69F00", "#56B4E9", "#009E73",
#"#F0E442", "#0072B2", "#000000", "#999999", "#A65628", "#CC79A7",
#"#E41A1C", "#F0E442", "#009E73")) +
#scale_color_manual(values = c("#CC79A7", "#D55E00", "#0072B2", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#000000", "#999999", "#A65628", "#CC79A7", "#E41A1C", "#F0E442", "#009E73")) +
geom_segment(aes(x = 3000, y = 0, xend = 3000, yend = 92),
color = "black", linetype = "dashed", size = 0.5)+
geom_segment(aes(x = 0, y = Inf, xend = 3000, yend = 92), color = "black",
linetype = "dashed",size=0.5)+
geom_segment(aes(x = 2000, y = 0, xend = 2000, yend = 75),
color = "black", linetype = "dashed", size = 0.5)+
geom_segment(aes(x = 0, y = Inf, xend = 2000, yend = 75), color = "black",
linetype = "dashed",size=0.5)+
geom_segment(aes(x = 750, y = 0, xend = 750, yend = 60),
color = "black", linetype = "dashed", size = 0.5)+
geom_curve(aes(x = 0, y = Inf, xend = 2000, yend = 50), color = "black", linetype = "dashed", size = 0.5,
curvature = 0.1, angle = 70) +
coord_cartesian(ylim = c(0, max(df$SSP)))+
theme_bw() +
theme(panel.grid = element_blank(),
panel.background = element_rect(fill = "white"))