-
Notifications
You must be signed in to change notification settings - Fork 0
/
rscirpt
27 lines (22 loc) · 1.63 KB
/
rscirpt
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
data <- read.csv(file="dataset_mazus.csv")
head(data)
library(ggplot2)
ggplot(data, aes(total_frame, length.of.petal.0.1mm.))+ geom_point(color="gray",size=4)
# the speed/proportion of each movement stage
data$begin<-data$onethird_movement/data$total_frame
data$mid<-data$twothird_movement/data$total_frame
data$end<-data$lastthird_movement/data$total_frame
# clustering by total movement time and petal length (method 1)
library(cluster)
mcluster <- kmeans(data[,c(5,9)], center=3)
clusplot(data, mcluster$cluster, color=T, shade=T, labels=0, lines=0)
data$cluster1<-mcluster$cluster
ggplot(data,aes(total_frame,length.of.petal.0.1mm., group=cluster1,colour = cluster1)) +geom_point(colour=data$cluster1,size=3)
ggplot(data,aes(total_frame,cluster2, group=cluster1,colour = cluster1)) +geom_point(colour=data$cluster2,size=3)
ggplot(data,aes(length.of.petal.0.1mm.,cluster2, group=cluster1,colour = cluster1)) +geom_point(colour=data$cluster2,size=3)
ggplot(data,aes(onethird_movement,twothird_movement, group=cluster2,colour = cluster2)) +geom_point(colour=data$cluster1,size=2)+geom_smooth(method = "loess",se = FALSE)
ggplot(data,aes(onethird_movement,lastthird_movement, group=cluster2,colour = cluster2)) +geom_point(colour=data$cluster2,size=2)+geom_smooth(method = "loess",se = FALSE)
data$inflorescence_total<-data$inflorescence_close+data$inflorescence_open+data$inflorescence_shedding
data$inflorescence_position<-data$inflorescence_total-data$inflorescence_close
ggplot(data,aes(total_frame,inflorescence_total)) +geom_point(colour=data$cluster2,size=2)
ggplot(data,aes(total_frame,inflorescence_position)) +geom_point(colour=data$cluster2,size=2)