microsoft / lida

Automatic Generation of Visualizations and Infographics using Large Language Models
https://microsoft.github.io/lida/
MIT License
2.57k stars 260 forks source link

interactive charts in plotly #86

Closed himanshu-nakrani closed 5 months ago

himanshu-nakrani commented 5 months ago

is there any way I can get interactive plotly chart. currently the chart is exported as png image in library code.

image
Ujjwalshaw commented 4 months ago

What is fix for the mentioned issue, I am trying to create interactive chart using plotly but am unable to find a way for the same? Could you please help me out?

himanshu-nakrani commented 4 months ago

fix is you run python code directly in your environment and update plotly parameters according to your need.

        library = "plotly"
        charts = lida.visualize(summary=summary, goal= str(goals[i]) + " use px.colors.qualitative.Plotly as color pellete" , textgen_config=textgen_config, library=library)  

        data = pd.read_csv("../utils/temp_dataframe.csv")
        ex_locals = executor.get_globals_dict(charts[0].code, data)
        exec(charts[0].code, ex_locals)
        chart = ex_locals["chart"]

        fig = ex_locals['plot'](data)

        fig.update_layout(colorway=px.colors.qualitative.Plotly)