How to visualize an html file created using plotly.graph_objects using an iPhone's File App?

45 Views Asked by At

I am creating html reports that I am sending to myself as email attachments. I use the plotly.graph_objects write_html function to create these html files. These can be visualized upon download using a web browser (e.g. Firefox). However, when downloading them on my iPhone, I cannot visualize them using the File App.

Here's an example script:

import pandas as pd
import plotly.graph_objects as go
import numpy as np

def create_report(df):


    ## PIE CHART
    mypiechart = go.Pie(labels=df.B.unique(), values=df.groupby('B').count()['A'].astype('int').to_list())

    fig = go.Figure()

    fig.add_trace(
        mypiechart 
    )


    fig.update_layout(
        height=800,
        width=1400,
        bargap=0.15,
        bargroupgap=0.1,
        barmode="stack",
        hovermode="x",
        margin=dict(r=1, l=1, b=1, t=100))

    fig.write_html("report.html")
    return 

df = pd.DataFrame()
df['A'] = np.random.randn(10)
df['B'] = ['Category1','Category1','Category1','Category2','Category1','Category1','Category2','Category1','Category1','Category1']

create_report(df)

This the report output by the above code:

enter image description here

How can I visualize these files using the File App?

0

There are 0 best solutions below