Created
June 20, 2022 05:04
-
-
Save monochromec/3dc9433ee226ae2bc46128968c9d1844 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import plotly.graph_objects as go | |
from dash import Dash, html, dcc | |
app = Dash(__name__) | |
surf = {'2020': [0, 0, 0, 0, 2009, 2068, 2047, 2215, 2011, 2161, 2014, 2089, 2197, 1936, 2093, 2097, 1980, 2008, 1970, 2137, 2089, 1901, 2103, 2190], '2021': [1737, 1449, 1914, 1874, 1982, 2017, 2240, 2147, 2122, 2051, 2128, 2057, 2055, 2118, 1954, 2064, 2058, 2181, 2143, 2155, 2168, 2112, 2080, 2162], '2022': [97, 128, 87, 1269, 1605, 1610, 1668, 1722, 1759, 1736, 1941, 1834, 1815, 1912, 0]} | |
x_ax = [['', 'Jan', '', 'Feb', '', 'Mar', '', 'Apr', '', 'May', '', 'Jun', '', 'Jul', '', 'Aug', '', 'Sep', '', 'Oct', '', 'Nov', '', 'Dec']] | |
years = ['2020', '2021', '2022'] | |
year = 2025 | |
p = pd.DataFrame.from_dict(surf, orient='index', columns=x_ax) | |
fig = go.Figure(data=[go.Surface(z=p.values, showscale=False)]) | |
fig.update_layout(title=f'Year {year}', autosize=False, margin=dict(l=60, r=60, b=60, t=30, pad=10), width=650, height=650, | |
scene=dict( | |
xaxis=dict(tickmode='array', ticktext=list(p.columns), tickvals=list(range(0, 25)), title='Epis'), | |
yaxis=dict(tickmode='array', ticktext=years, tickvals=list(range(0, len(years))), title='Years'), | |
zaxis=dict(title='# of downloads') | |
)) | |
fig.update_yaxes(automargin=True) | |
fig.update_xaxes(automargin=True) | |
app.layout = html.Div( | |
children=[ | |
html.H1(year, style={'textAlign':'center', 'color':'#7FDB00'}), | |
dcc.Graph(id='stats-graph', figure=fig) | |
] | |
) | |
app.run_server(debug=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment