I coded simple sankey with r googleVis package:
DF= data.frame(From=c('A', 'B', 'C'),
To=c('D','D', 'F'),
Weight=c(0.460, 5.100, 2.393),
Weight.html.tooltip = paste(c(0.460, 5.100, 2.393), paste(expression(m^3))))
plot(gvisSankey(DF,from="From", to="To", weight="Weight",
options=list(width = "1200",
height = "600",
sankey="{
link: {colorMode: 'gradient', color: { fill: '#green' } },
node: {nodePadding: 80, width:50, color: { fill: '#a61d4c'} },
tooltip: {isHtml:'true'}
}"
)))
I am trying to get units in cubic meters, but I am stuck. Usually, superscript text is implemented with expression
function in r. But in this case, labels are strings from a data.frame. Is there a way to write strings in superscript text?
After quite some time, here is the solution of my problem. I also formatted digits, since display is more convenient that way.