Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sankey Diagram Not Resolving HTML Tags in Labels #1499

Open
JMante1 opened this issue Apr 7, 2019 · 4 comments
Open

Sankey Diagram Not Resolving HTML Tags in Labels #1499

JMante1 opened this issue Apr 7, 2019 · 4 comments
Labels
bug something broken P3 backlog

Comments

@JMante1
Copy link

JMante1 commented Apr 7, 2019

When using html tags in the labels of a Sankey diagram the html itself is displayed rather than the resolved form (even though in the hover labels it is resolved).

I have added an example of code that generates this error below:

import plotly

data = dict(
    type='sankey',
    node = dict(
      pad = 15,
      thickness = 20,
      line = dict(
        color = "black",
        width = 0.5
      ),
      label = ['<a href="https://plot.ly/python/sankey-diagram/">A1</a>', 
                '<a href="https://plot.ly/python/sankey-diagram/">A2</a>', 
                '<a href="https://plot.ly/python/sankey-diagram/">B1</a>', 
                '<a href="https://plot.ly/python/sankey-diagram/">B2</a>', 
                '<a href="https://plot.ly/python/sankey-diagram/">C1</a>', 
                '<a href="https://plot.ly/python/sankey-diagram/">C2</a>'],
      color = ["blue", "blue", "blue", "blue", "blue", "blue"]
    ),
    link = dict(
      source = [0,1,0,2,3,3],
      target = [2,3,3,4,4,5],
      value = [8,4,2,8,4,2]
  ))

layout =  dict(
    title = "Basic Sankey Diagram",
    font = dict(
      size = 10
    )
)

fig = dict(data=[data], layout=layout)
plotly.offline.plot(fig, filename = 'issue.html', auto_open=True)


@jonmmease
Copy link
Contributor

Thanks for the report @JMante1. @antoinerg, as things stand right now, do you expect HTML formatting to work in Sankey labels? Thanks!

@antoinerg
Copy link
Contributor

antoinerg commented Apr 8, 2019

Thank you @JMante1 for reporting this issue!

do you expect HTML formatting to work in Sankey labels?

@jonmmease I expected it to work but it seems like this feature wasn't implemented. I would consider this is a bug. I opened an issue here: plotly/plotly.js#3742

@jonmmease jonmmease added bug something broken plotly.js and removed question labels Apr 9, 2019
@jonmmease
Copy link
Contributor

Thanks @antoinerg!

@jsulopzs
Copy link

The same happens for parcats:

The following code:

    dim_nuevas = go.parcats.Dimension(
        values=df[elecciones_nuevas],
        categoryorder='category ascending',
        label='Elecciones Nuevas<br>'
    )

Will result in:

newplot

@gvwilson gvwilson self-assigned this Jun 13, 2024
@gvwilson gvwilson removed their assignment Aug 2, 2024
@gvwilson gvwilson added P3 backlog and removed plotly.js labels Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken P3 backlog
Projects
None yet
Development

No branches or pull requests

5 participants