customizing sankey plot in r using rcharts -
i trying build sankey chart application similar 1 shown at
https://www.r-bloggers.com/generating-sankey-diagrams-from-rcharts/
here sankey plot numbers 24407... , 8450... source , target , customer... sector
i build sankey chart sector in middle , source , target on either side of chart
here code followed group topics data frame has columns source, target, value, sector
grouptopics$source<-as.character(grouptopics$source) grouptopics$target<-as.character(grouptopics$target) grouptopicstemp<-aggregate(value~sector+source,grouptopics,sum) colnames(grouptopicstemp)<-c('source','target','value') gruptopicsa<-subset(grouptopics,select = c('source','target','value')) grouptopicsb<-rbind(grouptopicstemp,gruptopicsa) sankeyplottopics <- rcharts$new() sankeyplottopics$setlib('http://timelyportfolio.github.io/rcharts_d3_sankey/libraries/widgets/d3_sankey') sankeyplottopics$set( data = grouptopicsb, nodewidth = 15, nodepadding = 10, layout = 32, width = 960, height = 500 )
Comments
Post a Comment