Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Anonymous
Not applicable

sankey image was not created by R script

hi team,

 

i need your help. i have below R script run in PowerBI and want to create a sankey chart in visualize in PowerBI.

 

 

 

# The following code to create a dataframe and remove duplicated rows is always executed and acts as a preamble for your script: 

# dataset <- data.frame(source, target, value)
# dataset <- unique(dataset)

# Paste or type your script code here:
library(networkD3)
node_names <- unique(c(dataset$source, dataset$targe))
nodes <- data.frame(name=node_names)
links <- data.frame(source = match(dataset$source, node_names) - 1,
                    target = match(dataset$target, node_names) - 1,
                    value = dataset$value)
sankeyNetwork(Links = links, Nodes = nodes, 
              Source = "source",
              Target = "target",
              Value = "value")​

 

 

 

But i got 'No image was created'. how to resolve it to let the sankey chart displayed in PowerBI.cheriemilk_0-1642556083105.png

 

 
5 REPLIES 5
ebeery
Memorable Member
Memorable Member

@Anonymous I believe this falls under the below limitation from the Power BI R Visuals documentation.

ebeery_0-1642558091642.png


It seems as if the sankeyNetwork function in networkD3 does not send its results to the "Plot" device.  

See also this GitHub issue:

ebeery_1-1642558221205.png


https://github.com/MicrosoftDocs/powerbi-docs/issues/266 

Anonymous
Not applicable

what does it mean 'only plot to default device'?

@Anonymous also probably worth asking - is there a reason you cannot use the Sankey Chart custom visual on AppSource?

Anonymous
Not applicable

becuase the nodes are too many to show correctly in powerBI->snakey chart.

@Anonymous this is above my level of R expertise, but I from what I can gather networkD3 is not actually generating an R "plot" - it's generating an html widget that is displayed.  That is why when viewing in R Studio, it shows up under "Viewer" instead of under "Plots", and also probably what enables these graphics to be interactive.

More info can be found here:

https://bookdown.org/rdpeng/exdata/graphics-devices.html 

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.