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

allow provision of X coordinates only for Sankey charts #1732

Open
devin-moonrise opened this issue Aug 20, 2019 · 6 comments
Open

allow provision of X coordinates only for Sankey charts #1732

devin-moonrise opened this issue Aug 20, 2019 · 6 comments
Labels
feature something new P3 backlog

Comments

@devin-moonrise
Copy link

devin-moonrise commented Aug 20, 2019

This is somewhat of a duplicate of #960 and #1437 but slightly more hopeful :)
The x and y arguments of the nodes dict do successfully control node location, however -- it appears that both arguments must be supplied.

import dash
import dash_core_components as dcc
import dash_html_components as html
f#rom dash.dependencies import Output, Input, State
import plotly.graph_objs as go
#import pandas as pd

app = dash.Dash()
app.layout = html.Div([
    dcc.Graph(
        id = 'wut',
        figure={
            'data' : [
                dict(
                    type='sankey',
                    #domain = 
                    arrangement = 'fixed',
                        node = dict(
                            pad = 15,
                            thickness = 20,
                            line = dict(color = "black", width = 0.5),
                            label = ["A1", "A2", "B1", "B2", "C1", "C2"],
                            x = [0.1, 0.2, 0.24, 0.7, 0.8, .9],
                            y = [0, .2, .3, .4, .5, .6],
                            color = "blue"
                    ),
            link = dict(
                source = [0, 1, 0, 2, 3, 3], # indices correspond to labels, eg A1, A2, A2, B1, ...
                target = [2, 3, 3, 4, 4, 5],
                value = [8, 4, 2, 8, 4, 2]
            ))        
        ]}   
)])

if __name__ == '__main__':
    app.run_server(debug=True)

VS.

import dash
import dash_core_components as dcc
import dash_html_components as html
f#rom dash.dependencies import Output, Input, State
import plotly.graph_objs as go
#import pandas as pd

app = dash.Dash()
app.layout = html.Div([
    dcc.Graph(
        id = 'wut',
        figure={
            'data' : [
                dict(
                    type='sankey',
                    #domain = 
                    arrangement = 'fixed',
                        node = dict(
                            pad = 15,
                            thickness = 20,
                            line = dict(color = "black", width = 0.5),
                            label = ["A1", "A2", "B1", "B2", "C1", "C2"],
                            ###x = [0.1, 0.2, 0.24, 0.7, 0.8, .9],
                            y = [0, .2, .3, .4, .5, .6],
                            color = "blue"
                    ),
            link = dict(
                source = [0, 1, 0, 2, 3, 3], # indices correspond to labels, eg A1, A2, A2, B1, ...
                target = [2, 3, 3, 4, 4, 5],
                value = [8, 4, 2, 8, 4, 2]
            ))        
        ]}   
)])

if __name__ == '__main__':
    app.run_server(debug=True)
@johentsch
Copy link

+1 for the possibility to define x coordinates only.

@1kastner
Copy link

That would still be a super helpful feature!

@RemDelaporteMathurin
Copy link

Is there a way to at least obtain the nodes position after the chart creation?

This way, a workaround could be:

  • let the nodes positions be the default ones
  • get these positions
  • modifiy the positions a posteriori

@steffi1mb
Copy link

Is there a way to at least obtain the nodes position after the chart creation?

This way, a workaround could be:

  • let the nodes positions be the default ones
  • get these positions
  • modifiy the positions a posteriori

That would still be helpful or has this been done?

@johentsch
Copy link

That would indeed be a helpful workaround, haven't found a way to retrieve coordinates so far, anyone else?

@janscholten
Copy link

I'm also trying to get the node positions, but to no avail. The choice between 'freeform', 'fixed', and 'snap' doesn't seem to matter for this.

@gvwilson gvwilson self-assigned this Jun 13, 2024
@gvwilson gvwilson removed their assignment Aug 2, 2024
@gvwilson gvwilson added the P3 backlog label Aug 12, 2024
@gvwilson gvwilson changed the title Sankey node x and y positions require both variables set to reflect in chart. allow provision of X coordinates only for Sankey charts Aug 12, 2024
@gvwilson gvwilson added the feature something new label Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new P3 backlog
Projects
None yet
Development

No branches or pull requests

7 participants