I'm using Riverplot to create Sankey plots and placing them in one plot to create a continuous look with three plots. My problem is that I only want node labels on the outmost left and right nodes, not inside.
I've managed to remove the labels from the middle plot with the following code to create the objects, but I was wondering if there is a way to remove only one side of the labels. I've tried creating blank node labels, but both sides of the plot get removed when I've done this.
make_rp = function(edges) {
nodes = data.frame(ID=unique(c(edges$N1, edges$N2)),
x=rep(c(1,2), each=9))
style = sapply(nodes$ID, function(id)
list(col=cols[gsub('( |) ', '', id)]),
simplify=FALSE)
rp = makeRiver(nodes, edges, styles=style)
}
make_rp_inner = function(edges) {
nodes = data.frame(ID=unique(c(edges$N1, edges$N2)),
x=rep(c(1,2), each=9))
style = sapply(nodes$ID, function(id)
list(col=cols[gsub('( |) ', '', id)]),
simplify=FALSE)
rp = makeRiver(nodes, edges, styles=style, node_labels=c('','','','','','','','',''))
}
and this is my code for plotting:
par(mar=c(0,0,0,0), mfrow=c(1,3), cex=1.2)
riverplot(rp_90_00,srt=0, plot_area=c(1,.7), gravity='top',
nodewidth=1.2, node_margin=0.2, fix.pdf=TRUE)
riverplot(rp_00_10,srt=0, plot_area=c(1,.7), gravity='top',
nodewidth=1, node_margin=0.2, fix.pdf=TRUE) # uses rp_innner function
riverplot(rp_10_20,srt=0, plot_area=c(1,.7), gravity='top',
nodewidth=1.4, node_margin=0.2, fix.pdf=TRUE)
This is the plot I have currently and I want all but the labels on the outside to be removed.
I fear this might be impossible with how the Riverplot package is set up, but any help would be appreciated.