ricklupton / ipysankeywidget

IPython / Jupyter Sankey diagram widget
MIT License
174 stars 24 forks source link

Long labels of source and target gets cut off :'( #40

Closed cuddle-cuddle closed 4 years ago

cuddle-cuddle commented 5 years ago

Long labels gets cut off. Sometimes I need long labels. I've been trying to get it to work all weekend. :'(

Thank you very much for helping!

for example, the image is produced by: cutoff_example

`layout = Layout( width="600", height="600",

margins=dict(left=300, right=300, top=50, bottom=50),

            #paddings=dict(left=300, right=300, top=50, bottom=50),
            flex_flow='row wrap', overflow = 'visible',
            border='1px solid black',
            grid_auto_flow='row',
            display='block'
           )

flows = pd.read_csv('simple_fruit_sales.csv') flows['source'] = flows['source'].apply(lambda x: x + "\nblahblah\n100000\n") flows['target'] = flows['target'].apply(lambda x: x + " derpy derp derp") w = SankeyWidget(links=flows.to_dict('records'), layout=layout) w `

cuddle-cuddle commented 5 years ago

code:

layout = Layout( width="600", height="600",

margins=dict(left=300, right=300, top=50, bottom=50),

            #paddings=dict(left=300, right=300, top=50, bottom=50),
            flex_flow='row wrap', overflow = 'visible',
            border='1px solid black',
            grid_auto_flow='row',
            display='block'
           )

flows = pd.read_csv('simple_fruit_sales.csv') flows['source'] = flows['source'].apply(lambda x: x + "\nblahblah\n100000\n") flows['target'] = flows['target'].apply(lambda x: x + " derpy derp derp") w = SankeyWidget(links=flows.to_dict('records'), layout=layout) w

ricklupton commented 5 years ago

Try this:

w = SankeyWidget(links=links, margins=dict(top=0, bottom=0, left=50, right=100))

From here: https://nbviewer.jupyter.org/github/ricklupton/ipysankeywidget/blob/master/examples/Simple%20example.ipynb

ricklupton commented 4 years ago

Closing this now assuming that worked.