forked from austinlasseter/flying-dog-beers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
63 lines (55 loc) · 1.42 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go
########### Define your variables
beers=['Chesapeake Stout', 'Snake Dog IPA', 'Imperial Porter', 'Double Dog IPA']
ibu_values=[35, 60, 85, 75]
abv_values=[5.4, 7.1, 9.2, 4.3]
color1='darkred'
color2='orange'
mytitle='Beer Comparison'
tabtitle='beer!'
myheading='Flying Dog Beers'
label1='IBU'
label2='ABV'
githublink='https://github.com/austinlasseter/flying-dog-beers'
sourceurl='https://www.flyingdog.com/beers/'
########### Set up the chart
bitterness = go.Bar(
x=beers,
y=ibu_values,
name=label1,
marker={'color':'darkgreen'}
)
alcohol = go.Bar(
x=beers,
y=abv_values,
name=label2,
marker={'color':'blue'}
)
beer_data = [bitterness, alcohol]
beer_layout = go.Layout(
barmode='group',
title = mytitle
)
beer_fig = go.Figure(data=beer_data, layout=beer_layout)
########### Initiate the app
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
server = app.server
app.title=tabtitle
########### Set up the layout
app.layout = html.Div(children=[
html.H1(myheading),
dcc.Graph(
id='flyingdog',
figure=beer_fig
),
html.A('Code on Github', href=githublink),
html.Br(),
html.A('Data Source', href=sourceurl),
]
)
if __name__ == '__main__':
app.run_server()