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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
RogerSteinberg
Post Patron
Post Patron

How to use Plotly to create sankey chart

I am trying to bypass the sankey chart from the marketplace because it is very flawed.

So, I am trying to create my chart using the R script visual from the Visualizations Panel. However, it appears using plotly with sankey doesnt work. Here's a sample of the R script:

library(plotly)

p <- plot_ly(
    type = "sankey",
    orientation = "h",

    node = list(
      label = c("A1", "A2", "B1", "B2", "C1", "C2"),
      color = c("blue", "blue", "blue", "blue", "blue", "blue"),
      pad = 15,
      thickness = 20,
      line = list(
        color = "black",
        width = 0.5
      )
    ),

    link = list(
      source = c(0,1,0,2,3,3),
      target = c(2,3,3,4,4,5),
      value =  c(8,4,2,8,4,2)
    )
  ) %>% 
  layout(
    title = "Basic Sankey Diagram",
    font = list(
      size = 10
    )
)
2 ACCEPTED SOLUTIONS

Hi @RogerSteinberg,

 

Actually, It seems like also not works on power bi side. When I test with r studio, it works well...
Have you test to use records from dataframe which you dragged to r script value fields to create other graph?

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

The problem is that I only want this graph for the purpose of my project. But I guess I'll wait for furture updates.

 

Thank you

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

@RogerSteinberg , have you find a solution to generate sankey chart in powerBI service with R plotly? If yes, could you help share?

v-shex-msft
Community Support
Community Support

Hi @RogerSteinberg,

 

>>However, it appears using plotly with sankey doesnt work. Here's a sample of the R script:
Did you means use sankey graph to interaction with other visuals? If this is a case, current r visual graph can't interact with other visual, it can be affected by other visual or filters.

 

You can also take a look at following link about use r visual to draw sankey graph:

Creating Custom Sankey Diagrams Using R

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi XiaoXin,

 

So if I understand correctly, I could apply the logic of your link to create a sankey chart using the R visual within Power Bi?

Hi @RogerSteinberg,

 

Actually, It seems like also not works on power bi side. When I test with r studio, it works well...
Have you test to use records from dataframe which you dragged to r script value fields to create other graph?

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

The problem is that I only want this graph for the purpose of my project. But I guess I'll wait for furture updates.

 

Thank you

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors