ipycytoscape
ipycytoscape copied to clipboard
Adjust the height of output graphs
Hi. I have a graph with many nodes and I'd like to be able to see it in full. by changing
out=widgets.Output(layout={'width': '800px', 'height': '800px','max_height':'100%', 'border': '1px solid black'}) out.display(cyto)
I get a bigger box for my graph but when I move the graph inside the box it gets cut in half (meaning the graph is limited to 400px no matter what). Is there a way to adjust this?
Thank you,
Hey @tmontana good question! I don't think we mention how to do this at all in the docs so sorry about that.
The cytoscape
object defines it's own dimensions in terms of pixels independent of it is parent element (in this case an output widget). Because the output widget and the cytoscape object are separate widget objects that don't really know how to talk to eachother changes will no propogate from one to the other. So you also need to modify the width and height. YOu can do that like so:
cyto.layout.height = '800px'
cyto.layout.width = '800px'
This strategy of setting object.layout.height
I think will work for also most everything that is derived from an ipywidget
as the layout
attribute is inherited from the widget superclass
We should definitely include this in the docs. If anyone is interested in adding it I can help walk you through the process
Hi ianhi. Works great now - Thanks a lot for the tip!