question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature Request] Parallel Coordinate Plot Deselected Line Colour

See original GitHub issue

Hi Team,

TL;DR: Please expose the deselected line colour as a property for the Parallel Coordinate Plot graph object.

I work with the parallel coordinate plot quite frequently (the plotly graph objects version) outside of dash.

Often, end-users request that the grey colouring used for the deselected lines be removed for clarity. Currently this is not a default property exposed by the plotly graph object. The default colouring for the deselected lines is grey and the opacity I believe is determined by some logic depending on how many of the deselected lines overlap, although I could be wrong.

My work-around for this problem to date when working with static HTML files has been to open the HTML and simply find and replace any reference to deselected line colouring either manually or with python, changing the colour from the default to rgba(0,0,0,0).

This works for static HTML files, but having recently developed a tool in dash I cannot use the same work-around.

Instead, I have tried using a client-side call-back to modify the JavaScript code:

app.clientside_callback(
    """
    function (a, themeToggle) {
        // update deselected line colours
        Array.from(document.getElementsByClassName("parcoords-control-view"))[0].__data__.model.deselectedLines.color = [0,0,0,0];
        
        // update the brush colouring from magenta to grey
        Array.from(document.getElementsByClassName("highlight")).map(line => line.attributes.stroke.nodeValue = "grey");
    }
    """,
    Output(component_id='blank_output_2', component_property='children'),
    [
        Input(component_id='parallelcoord', component_property='figure'),
        Input(component_id='theme', component_property='value')
    ],
    prevent_inital_callback=True
)

This works on first load, however when a separate python call-back is triggered that updates the Parallel Coordinate Plot Figure component, the deselected grey line colouring returns, even though the client-side call-back is triggered to execute after the Parallel Coordinate Plot Figure component is updated (it is an input to this call-back).

When looking at the browser console, I can see that the client-side call-back has infact been executed and the colour property for the deselected lines is now rgba(0,0,0,0). But looking at the plot, the deselected lines are still grey until I make some adjustment to anything on the plot.

It is almost like a cached image of the plot is left on the screen which does not re-render until user input. Interestingly, other colouring / css properties altered through the same client-side call-back such as the brush colouring as shown in the above call-back will function without issue. It is just the deselected line colouring that does not update until I move something.

The video below shows the behaviour I am describing. Ultimately, exposing the deselected line colour as a property in the plotly graph object for the parallel coordinate would solve this error. However, if anyone else out there knows of a work-around in dash applications or has any ideas, please let me know.

https://user-images.githubusercontent.com/28840236/172745075-66919d6a-1007-4dde-985d-13c4ca433d37.mp4

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
archmojcommented, Jun 10, 2022

Hi @archmoj, thanks for getting onto this. Will this PR carry through into Dash or just Plotly.js?

The feature would be available in Dash after being implemented in plotly.js.

0reactions
mahannyacommented, Jul 5, 2022

Hi ! By when is the new version expected to release tentatively. Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

parallel coordinates plot - feature request - KNIME Forum
We've worked around it by included 2 fake matched pairs, one to set the bottom, another to set the top (see screenshot with...
Read more >
Create parallel coordinates plot - MATLAB parallelplot
This MATLAB function creates a parallel coordinates plot from the table tbl. ... Each line in the plot represents a row in the...
Read more >
Parallel coordinate plot - Python Graph Gallery
A collection of parallel coordinate chart examples made with Python, coming with explanation and reproducible code.
Read more >
Grace Tutorials
Some of examples require you to input a data file or graph. ... Experiment by changing the line colours and widths, placing a...
Read more >
ImageJ User Guide - IJ 1.46r | Analyze Menu - NIH
Features of thresholded images can be extracted by specifying ... Angle is the angle between the primary axis and a line parallel to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found