Skip to content

[FEATURE REQUEST] Add possibility to get "raw" plotly fig object #90

@jco-c

Description

@jco-c

Is your feature request related to a problem? Please describe.
I am integrating the fullcontrol package into a streamlit app, so that for a specific use case, users can easily customize their parameters and download the gcode and can see a preview.

I am doing this in streamlit so I can host the app and the user doesn't need to install python.

My issue is, that in the plotly function, fig.show() is used, which is not compatible with streamlit.

Describe the solution you'd like
An easy solution would be to add a PlotControls option as e.g. return_fig, which defaults to False.
When set to True, this could be added to the end of the plot function in plotly.py:

if not cicd_testing:
    fig.show()
## add this:
elif controls.return_fig:
    return fig
##
else:
    import plotly.io as pio
    from datetime import datetime
    pio.write_image(fig, datetime.now().strftime("figure__%d-%m-%Y__%H-%M-%S.png"))

To get the fig object would enable me to pass that to streamlit.plotly(), which takes a fig object and displays it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions