aazuspan / sankee

Visualize classified time series data with interactive Sankey plots in Google Earth Engine
https://sankee.readthedocs.io/en/latest/index.html
MIT License
97 stars 15 forks source link

Customize plot size #5

Closed giswqs closed 3 years ago

giswqs commented 3 years ago

I am trying to display the sankee plot directly within the map. As can be seen from the screenshot below, only a portion of the plot is visible due to the limited size of the hosting widget. It would be great if sankee can support customizing plot size so that it can fit into the hosting widget.

image

aazuspan commented 3 years ago

The object returned by sankee.sankify is a plotly.graph_objs._figure.Figure which allows a lot of flexibility in editing the plot after it's created. There are some useful examples here in the Graph Objects section.

In this case, you should be able to do something like:

plot = sankee.sankify( ... )
plot.update_layout(height=300, width=600)

You can also use update_layout to change text size, margins, colors, etc. I do plan on accepting optional keyword arguments and passing them to the plotting function in the future, but hopefully this solves your problem in the meantime.

giswqs commented 3 years ago

This is great to know. I like that you can edit the plot after its creation. This behaves very much like ipywidets. I will be integrating the sankee plot into the map. Many thanks.

giswqs commented 3 years ago

Thanks to your help, the sankee plot can now be directly displayed on the map and it is resizable https://github.com/giswqs/geemap/issues/471

https://user-images.githubusercontent.com/5016453/118071122-23e9c300-b375-11eb-9a06-ddde598a0023.mp4

aazuspan commented 3 years ago

Thanks for making this tool so much more accessible! Great work!