I made this code:
tiff("C:/Users/grego/OneDrive/Documentos/Meat_grades/Brazil_Beef_Quality/Bianca/lab_corr_geral.tiff", width =10 , height = 6, units = 'in', res = 200)
corr.data(final[c(14:24, 52:55)]) %>%
ggplot(aes(fct_relevel(colvars,'pH','PL','DL','EL','CL','L*','a*','b*','c*','h*','WBSF','TE','JU','FL','OA'),
fct_relevel(rowvars,'pH','PL','DL','EL','CL','L*','a*','b*','c*','h*','WBSF','TE','JU','FL','OA'))) +
geom_tile(colour="grey20", aes(fill=corr), size=0.5) +
#geom_point(aes(size=p.value, colour=cut(abs(corr), c(0, 0.01, 0.05, 1), include.lowest=TRUE)), pch=15) +
geom_text(aes(label=sprintf("%1.2f", corr)), position=position_nudge(y=0.2),
size=2.5, colour="black") +
geom_text(aes(label=paste0("(",sprintf("%1.2f", p.value),")")), position=position_nudge(y=-0.2),
size=2, colour="black") +
scale_fill_gradient2(low="red", mid="yellow2", high="blue", midpoint=0, limits=c(-1,1)) +
scale_size_continuous(range=c(8,12)) +
labs(x="",y="") +
theme (axis.text = element_text(size = 10), legend.position = "none") +
coord_fixed()
dev.off()
and I got this graph:
and I got This error:
Joining with `by = join_by(rowvars, colvars)`
Warning messages:
1: 5 unknown levels in `f`: L*, a*, b*, c*, and h*
2: 5 unknown levels in `f`: L*, a*, b*, c*, and h*
3: 5 unknown levels in `f`: L*, a*, b*, c*, and h*
4: 5 unknown levels in `f`: L*, a*, b*, c*, and h*
The label names are the same in my dataset. So the graph is ok for col label (L*, a*, b*, c*, and h*
), but the row label are wrong (L., a., b., c., and h.
). Some suggestion?