Ticktext does't show all the labels by discarding duplicate labels

I need to show all the labels and in my use case, some labels will be repeated. But plotly is only showing unique labels and not repeating the labels from the list. I’ve tried with plotly.js too.
Is this a bug? or there’s a way?

Here’s the code I ran

import plotly.graph_objects as go
import plotly.io as io

fig = go.Figure(data=
go.Parcoords(
    line_color='blue',
    dimensions=list([
        dict(range=[1, 5],
             constraintrange=[1, 2], 
             label='A', values=[1, 4]),
        dict(range=[1.5, 5],
             tickvals=[1.5, 3, 4.5],
             label='B', values=[3, 1.5]),
        dict(range=[1, 5],
             tickvals=[1, 2, 4, 5],
             label='C', values=[2, 4],
             ticktext=['Label_1', 'Label_2', 'Label_1', 'Label_2']),
        dict(range=[1, 5],
             label='D', values=[4, 2])
    ])
)
)

with open("plot_tmp.png", mode="wb") as file:
    image = io.to_image(fig, "png")
    file.write(image)

This is the generated plot

@rizwan486 With:

ticktext=['Label_1', 'Label_2', ' Label_1', ' Label_2'])

i.e. inserting a space before the repeating strings you’ll get displayed all labels.

@empet
But I don’t think it’s a solution. What if I need more copies than one? Thanks.

@rizwan486
This is workaround. For “a solution”, please, open an issue on the plotly.py repository

@empet
Here’s the issue I’ve created https://github.com/plotly/plotly.py/issues/4084

1 Like