library(ggplot2)
library(tidyr) # 使用的gather & spread
library(reshape2)
library(vcd)
library(plyr)
library(RColorBrewer)
library(ggpubr)
rm(list=ls())
###############################################################
### step1:直方图_密度图
Fig1_R1_dat<- read.csv("C:/Users/zhuwengen/Documents/FLIR0984_ABCD.csv")
colnames(Fig1_R1_dat)
# measure.vars只需要制定一个即可;另外一个默认是除指定的变量外的所有变量.
# 使用melt 函数将宽数据Fig1_dat转换为长数据Fig1_dat_long
Fig1_R1_long <- melt(Fig1_R1_dat,
measure.vars = c('A','B','C','D'), #用于聚合的变量,
variable.name = 'group',
value.name = 'temp')
mu1_R1 <- ddply(Fig1_R1_long, "group", summarise, grp.mean=mean(temp))
p1_R1 <- ggplot(Fig1_R1_long, aes(x = temp, fill = group)) +
geom_density(alpha = 0.6, size = 0.5) +
xlim(12.5, 15.5) +
geom_vline(data = mu1_R1, aes(xintercept = grp.mean, color = group),
linetype="dashed") +
theme_classic() +
scale_fill_manualp1_R1 + scale_fill_manual(values = c("#E41A1C","#377EB8","#4DAF4A","#984EA3")) +
geom_histogram(aes(y=..density..),
alpha = 0.4,
binwidth = 0.005,
position="identity") +
labs(title="Temperature density curve",
x = "Pixel Temperature(C)",
y = "Frequency")(values = c("#E41A1C","#377EB8","#4DAF4A","#984EA3"))
### step2:小提琴图
library("ggpubr")
Fig1_R1_long$group <- factor(Fig1_R1_long$group,
levels=c("A", "B", "C","D"),
ordered=TRUE)
# compare_means(temp~group, data = Fig1_R1_long, ref.group = "A") +
p3 <- ggviolin(Fig1_R1_long, x = "group", y = "temp", fill = "group",
palette = c( "#E41A1C","#377EB8","#4DAF4A","#984EA3"),
add = "boxplot",
add.params = list(fill = "white")) +
stat_compare_means(method="anova", label.y= 15.5) +
stat_compare_means(label="p.signif", method = "t.test", ref.group = "A")+
ylim(12.5, 17)
红外拍照数据处理
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- Python 2.7IDE Pycharm 5.0.3MySQL 5.7MySQL Workbench 6.3 前...
- 上周我的朋友晓彤突然找我求助,说领导让给她用一天的时间收集上半年的各项数据,包括明细进行汇总,然后需要对所有报表数...