Bez popisu

plot.py 590B

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