Shannon R
Shannon R

Reputation: 11

How to edit node to node layout and y-values in riverplot script in Rstudio?

Can someone please help me edit this script for riverplot in r? I am having two issues, 1. my y values are not working 2. I need to edit the N1 -> N2 layout

This is the script I have been running, and I have attached the excel spreadsheet I have organized this in. I'm a beginner, and have looked through many other forums and cannot figure out what I need to do.

Thanks in advance!

nodes <- c( LETTERS[1:19] ) 

edges <- list( A= list( C= 100 ), B= list( C= 5.06), C= list( C= 8.80), 
               D= list( C= 6.11), E= list( C= 5.45), F= list( C= 25.77), 
               G= list( C= 15.22), H= list( C= 8.86), I= list( C= 4.28), 
               J= list( C= 12.62), K= list( C= 5.13), L= list( C= 1.84), 
               M= list( C= 8.25), N= list( C= 8.76), O= list( C= 3.75), 
               P= list( C= 0.11), Q= list( C= 2.49), R= list( C= 2.86), 
               S= list( C= 2.91 ) )

r <- makeRiver(nodes, edges, node_xpos= c( 1,2,2,2,2,2,2,3,3,3,3,3,3,4,4,4,4,4,4 ), 
               node_ypos= c(3.5,6,5,4,3,2,1,6,5,4,3,2,1,6,5,4,3,2,1), 
               node_labels= c(A= “Cell percentage (%)”, B= “B cells”, 
                              C= “Monocytes”, D= “Natural killers“, 
                              E= “Neutrophils”, F= “CD4+ T cells”, 
                              G= “CD8+ T cells”, H= “CD4 naive”, 
                              I= “CD4 activated”, J= “CD4 memory”, 
                              K= “CD8 naive”, L= “CD8 activated”, 
                              M= “CD8 memory”, N= “CD4 CM”, 
                              O= “CD4 EM”, P= “CD4 TEMRA”, 
                              Q= “CD8 CM”, R= “CD8 EM”, S= “CD8 TEMRA” ), 
              node_styles= list( A= list( col= "yellow" )) ) 

plot( r ) 

Riverplot layout I want and the plot I am getting with the code above

Fig

Upvotes: 1

Views: 81

Answers (0)

Related Questions