import plotly.graph_objects as go import numpy as np from base64 import b64encode from plotly.offline import plot import plotly.express as px class PlotSys: def __init__(self, store): self.store = store def pieChart(self): df = px.data.gapminder().query("year == 2007").query("continent == 'Europe'") df.loc[df['pop'] < 2.e6, 'country'] = 'Other countries' # Represent only large countries fig = px.pie(df, values='pop', names='country', title='Population of European continent') #fig.show() return plot(fig, output_type='div')