Home > Net >  Creating raincloud plot from a data frame in R
Creating raincloud plot from a data frame in R

Time:10-10

I wanted a visualization something like this

image I ended up getting like this one my image

I'm kind of close what I want to get except Im not able to separate them

Here is my data frame

 dput(dat_red)
structure(list(FAB = structure(c(5L, 1L, 5L, 3L, 2L, 4L, 6L, 
2L, 1L, 6L, 5L, 1L, 5L, 1L, 5L, 6L, 3L, 5L, 2L, 5L, 3L, 3L, 3L, 
1L, 3L, 1L, 1L, 1L), .Label = c("M0", "M1", "M2", "M3", "M4", 
"M5"), class = "factor"), Risk_Cyto = structure(c(2L, 3L, 2L, 
2L, 3L, 1L, 2L, 2L, 3L, 2L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 3L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L), .Label = c("Good", "Intermediate", 
"Poor"), class = "factor"), `TCGA-AB-2856` = c(0, 0.203446022561853, 
0.057566971226641, 0.050525640210207, 0.050663468813024, 0.108022967842345, 
0.03563961790061, 0.091955619434079, 0.09562601922977, 0.072990036124458, 
0.05292549370956, 0.134908910498566, 0.056146007781438, 0.166755814327401, 
0.072370918290216, 0.092982169160965, 0.053571132330207, 0.026946730545354, 
0.096491482450314, 0.086393933157139, 0.086056971395349, 0.059872483122941, 
0.05562972070039, 0.080629871622231, 0.06458076058265, 0.109295018454197, 
0.15019108327262, 0.122208033564744), `TCGA-AB-2849` = c(0.203446022561853, 
0, 0.138756102002674, 0.109150212934145, 0.130381628657973, 0.186028570196918, 
0.201142265508601, 0.117008908236162, 0.07523492135779, 0.237542759238287, 
0.154026516322799, 0.093169870680731, 0.174873827256869, 0.077917778705184, 
0.217466101351585, 0.247196178178148, 0.139168631446623, 0.130879779506245, 
0.094044964277672, 0.102330796604311, 0.115883670128914, 0.106007290303468, 
0.124207778875499, 0.100051046626221, 0.096898638044544, 0.081075416500332, 
0.066801569316824, 0.095571899845876), `TCGA-AB-2971` = c(0.057566971226641, 
0.138756102002674, 0, 0.057153443556063, 0.049118618822663, 0.108803803345704, 
0.038593571058361, 0.05623480754803, 0.061897696825206, 0.056921365921972, 
0.027147582644049, 0.100579305160467, 0.031712766628694, 0.099623521686644, 
0.043315406299788, 0.079156224894216, 0.070713735063067, 0.042797402350358, 
0.064121331342957, 0.076245258448711, 0.057969352005916, 0.056411884330189, 
0.029950269541688, 0.052538503817376, 0.053263317374002, 0.073813902166228, 
0.081932722355952, 0.095255347468669), `TCGA-AB-2930` = c(0.050525640210207, 
0.109150212934145, 0.057153443556063, 0, 0.040710142137316, 0.087506794353747, 
0.076018856821365, 0.054334641613629, 0.043854827190482, 0.121490922447548, 
0.060145981627256, 0.070829823037578, 0.0708179998993, 0.083561655580485, 
0.106626803408534, 0.149000581782327, 0.049861493156012, 0.018112612744773, 
0.05246829209315, 0.041582348253964, 0.053306367816997, 0.035373116643303, 
0.042875256342202, 0.03406333799917, 0.036306618864362, 0.045647830531497, 
0.084727864328183, 0.079147350281325), `TCGA-AB-2891` = c(0.050663468813024, 
0.130381628657973, 0.049118618822663, 0.040710142137316, 0, 0.117167203965628, 
0.057145523476846, 0.07089819966556, 0.058848771210843, 0.090222074046894, 
0.052188574602838, 0.091623506635555, 0.053000329480576, 0.094592248885481, 
0.082033497053918, 0.111240839210373, 0.065982245111563, 0.038618210190806, 
0.063406266346048, 0.062231987650712, 0.067503749234478, 0.039970960455281, 
0.042758552599394, 0.049740193805893, 0.04884538212911, 0.07959023948363, 
0.090749468265183, 0.075792324166325)), class = "data.frame", row.names = c(NA, 
-28L))

My code

dat_red = read.csv("JSD_test_map_.txt",sep = "\t",check.names = FALSE)

df_melt = melt(JSD_MAP, id.vars=c("FAB","Risk_Cyto")

)

To plot the above I used this enter image description here

  • Related