I plotted a density distribution of a genes list from DEGs analysis results (the command lines as below) and got a notification of "Picking joint bandwidth of NaN" alongside an empty plot. Please could you suggest solutions for this issue. Any help would be appreciated.
(1) Below is the input data:
densityDat <- structure(list(hgnc_symbol = c("C4BPB", "CR1", "C3AR1", "CFH",
"ITGAM", "ITGAX", "C3", "FCN1", "MASP2", "C1QC", "C1R", "CFI",
"C1QB", "C8A", "C5", "MASP1", "CD55", "CFHR4", "C1S", "CFP",
"C1QBP", "C1RL", "C1QA", "SERPING1", "CR1L", "CFHR2", "C1QL1",
"CFB", "CLU", "FCN3", "C5AR1", "C7", "CFHR1", "C5AR2", "C4A",
"C4B", "C4BPA", "FCN2", "C2", "CD59", "C6", "C8B", "CFD", "CFHR5",
"CFHR3", "C8G", "CD46", "C1QL3", "VTN", "MBL2", "C9", "CD93",
"CR2", "C1QL2", "CSMD1", "C1QL4"), log2FoldChange = c(-0.2022669477,
0.5856227727, 0.327734267, 0.1208421748, 0.292806594, 0.3348429841,
0.1440450114, 0.4889441308, -0.09074408483, 0.2326664867, -0.09210100715,
0.08192022534, 0.2077400462, -0.08730483156, 0.07900806983, -0.07002339558,
0.0977811886, 0.147418281, -0.03670916462, 0.09751082084, 0.04135812882,
-0.04617216804, 0.09445741839, -0.04514402214, 0.1753123252,
0.09271858966, 0.1781337414, 0.1054747099, -0.03874564927, 0.08784815986,
0.1251974094, -0.1103445435, 0.1023721322, 0.07016178256, 0.09840340863,
0.0564565585, -0.02423745437, 0.04083730377, 0.0212734394, 0.01188001465,
-0.01494650387, -0.01521171741, 0.04201977736, -0.02778154869,
-0.04059310861, -0.01757112633, -0.005442877249, -0.04071530983,
-0.005873300304, 0.01725848587, -0.001094874809, -0.0005301944319,
0.6703912026, -0.08108344665, 1.582626788, -0.105467524), FDR = c("<=0.1",
"<=0.1", "<=0.1", "<=0.1", "<=0.1", "<=0.1", "<=0.1", "<=0.1",
">0.1", ">0.1", ">0.1", ">0.1", ">0.1", ">0.1", ">0.1", ">0.1",
">0.1", ">0.1", ">0.1", ">0.1", ">0.1", ">0.1", ">0.1", ">0.1",
">0.1", ">0.1", ">0.1", ">0.1", ">0.1", ">0.1", ">0.1", ">0.1",
">0.1", ">0.1", ">0.1", ">0.1", ">0.1", ">0.1", ">0.1", ">0.1",
">0.1", ">0.1", ">0.1", ">0.1", ">0.1", ">0.1", ">0.1", ">0.1",
">0.1", ">0.1", ">0.1", ">0.1", ">0.1", ">0.1", ">0.1", ">0.1"
)), class = "data.frame", row.names = c("5426", "19618", "13155",
"7", "12690", "8003", "5693", "1649", "237", "10305", "10345",
"20168", "13491", "10061", "3365", "5894", "17054", "6890", "15207",
"5846", "3551", "7777", "13492", "9166", "17495", "1514", "6396",
"36836", "5107", "8276", "17393", "4122", "37186", "6966", "37310",
"25302", "5425", "10474", "11807", "1644", "560", "414", "17508",
"6895", "4622", "14170", "4694", "11726", "3627", "11595", "4206",
"5713", "4693", "8518", "15395", "16337"))
(2) The script (FDR was already factorised with 2 levels):
library(ggplot2)
library(ggridges)
myColors <- c("red","grey")
p<-ggplot(densityDat) +
aes(x = log2FoldChange, y = hgnc_symbol, fill = FDR, color =FDR) +
geom_density_ridges(alpha = 0.75) +
scale_fill_manual(values=myColors)+
scale_color_manual(values=myColors)+
theme_ridges()
ggsave(filename = "CPdensity.png",
width = 10, height = 8, dpi = 320, units = "in", device='png')
dev.off()
(3) The output plot
(4) The desired output