Search code examples
dashboardholoviewsrapidscudfdatashader

How to save the data drawn by cuxfilter as an image


I am considering drawing a network.

For example, as shown in the demo, we can use the dashboard to get the chart, but there is no "save button" on the right side, as is often the case.

cux_df = cuxfilter.DataFrame.load_graph((nodes, edges))

chart0 = cuxfilter.charts.dashader.graph(node_pixel_shade_type='linear', unselected_alpha=0.2)

d = cux_df.dashboard([chart0], layout=cuxfilter.layouts.double_feature)
chart0.view()

Since we are using large data, we would like to take advantage of cuxfilter's quick drawings. If holoviews, for example, it takes too long to compute. Screen captures, etc. are possible, but is there any way to save the resulting figure?

Drawing with datashader took too long. I could create a view screen with cuxfilter.


Solution

  • The only way right now is to use the dashboard preview() function, which screen captures the dashboard in it's initial state and saves it as a png file. The way to do that is as follows:

    cux_df = cuxfilter.DataFrame.load_graph((nodes, edges))
    
    chart0 = cuxfilter.charts.dashader.graph(node_pixel_shade_type='linear', unselected_alpha=0.2)
    
    d = cux_df.dashboard([chart0], layout=cuxfilter.layouts.double_feature)
    await d.preview()
    

    This would only work in a jupyter lab/notebook environment though, and is restrictive in capturing current state.

    Based on your suggestion, it was as easy as adding an extra tool to the chart using bokeh, so we ended up adding it as a new feature, for all the bokeh and datashader based charts, the progress can be tracked here. To try it out once the changes are merged, you would have to install the cuxfilter nightly version (23.02). Once the changes are merged, this is how the toolbar would look:

    enter image description here