Skip to content

Add output_type option to figure_factory functions #1079

Closed
@jonmmease

Description

@jonmmease

I propose we add a new option to all figure factory methods named output_type. This may be set to 'Figure' (default), 'FigureWidget', or 'dict'.

Setting output_type to 'dict' would return only the dictionary version of the figure. This would be the fastest path, especially for figure factories that produce figures with lost of traces. It would provide an option for people to construct a complex figure with a figure factory, customize it, and then save it with plot/iplot without validation using the validate=False option. See dendrogram use-case described in #1052.

Setting output_type to 'FigureWidget' would directly return a FigureWidget instance. It would also open the door for figure factories to pre-install interactive functionality using callbacks for use in the Jupyter Notebook.

For example, we could add a datashader_scatter_plot figure factory that wraps the logic from this notebook: https://github.com/jonmmease/plotly_ipywidget_notebooks/blob/master/notebooks/DataShaderExample.ipynb. If ouput_type is 'Figure' or 'dict' then the datashader logic is executed once to build the data image for the initial axes ranges. If the ouput_type is 'FigureWidget' then, in addition, we would install the zoom/resize callback logic to automatically recompute the data image on zoom/resize.

@chriddyp @cldougl @Kully

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions