11# Bokeh libraries
2- from bokeh .plotting import figure , show
2+ from bokeh .plotting import figure
33from bokeh .models import ColumnDataSource , CDSView , GroupFilter
44
55# Create a ColumnDataSource
6- standings_cds = ColumnDataSource (standings )
6+ standings_cds = ColumnDataSource (standings ) # noqa
77
88# Create the views for each team
9- celtics_view = CDSView (source = standings_cds ,
10- filters = [GroupFilter (column_name = 'teamAbbr' ,
11- group = 'BOS' )])
9+ celtics_view = CDSView (
10+ source = standings_cds ,
11+ filters = [GroupFilter (column_name = "teamAbbr" , group = "BOS" )],
12+ )
1213
13- raptors_view = CDSView (source = standings_cds ,
14- filters = [GroupFilter (column_name = 'teamAbbr' ,
15- group = 'TOR' )])
14+ raptors_view = CDSView (
15+ source = standings_cds ,
16+ filters = [GroupFilter (column_name = "teamAbbr" , group = "TOR" )],
17+ )
1618
17- rockets_view = CDSView (source = standings_cds ,
18- filters = [GroupFilter (column_name = 'teamAbbr' ,
19- group = 'HOU' )])
20- warriors_view = CDSView (source = standings_cds ,
21- filters = [GroupFilter (column_name = 'teamAbbr' ,
22- group = 'GS' )])
19+ rockets_view = CDSView (
20+ source = standings_cds ,
21+ filters = [GroupFilter (column_name = "teamAbbr" , group = "HOU" )],
22+ )
23+ warriors_view = CDSView (
24+ source = standings_cds ,
25+ filters = [GroupFilter (column_name = "teamAbbr" , group = "GS" )],
26+ )
2327
2428# Create and configure the figure
25- east_fig = figure (x_axis_type = 'datetime' ,
26- plot_height = 300 ,
27- x_axis_label = 'Date' ,
28- y_axis_label = 'Wins' ,
29- toolbar_location = None )
30-
31- west_fig = figure (x_axis_type = 'datetime' ,
32- plot_height = 300 ,
33- x_axis_label = 'Date' ,
34- y_axis_label = 'Wins' ,
35- toolbar_location = None )
29+ east_fig = figure (
30+ x_axis_type = "datetime" ,
31+ plot_height = 300 ,
32+ x_axis_label = "Date" ,
33+ y_axis_label = "Wins" ,
34+ toolbar_location = None ,
35+ )
36+
37+ west_fig = figure (
38+ x_axis_type = "datetime" ,
39+ plot_height = 300 ,
40+ x_axis_label = "Date" ,
41+ y_axis_label = "Wins" ,
42+ toolbar_location = None ,
43+ )
3644
3745# Configure the figures for each conference
38- east_fig .step ('stDate' , 'gameWon' ,
39- color = '#007A33' , legend = 'Celtics' ,
40- source = standings_cds , view = celtics_view )
41- east_fig .step ('stDate' , 'gameWon' ,
42- color = '#CE1141' , legend = 'Raptors' ,
43- source = standings_cds , view = raptors_view )
44-
45- west_fig .step ('stDate' , 'gameWon' , color = '#CE1141' , legend = 'Rockets' ,
46- source = standings_cds , view = rockets_view )
47- west_fig .step ('stDate' , 'gameWon' , color = '#006BB6' , legend = 'Warriors' ,
48- source = standings_cds , view = warriors_view )
46+ east_fig .step (
47+ "stDate" ,
48+ "gameWon" ,
49+ color = "#007A33" ,
50+ legend = "Celtics" ,
51+ source = standings_cds ,
52+ view = celtics_view ,
53+ )
54+ east_fig .step (
55+ "stDate" ,
56+ "gameWon" ,
57+ color = "#CE1141" ,
58+ legend = "Raptors" ,
59+ source = standings_cds ,
60+ view = raptors_view ,
61+ )
62+
63+ west_fig .step (
64+ "stDate" ,
65+ "gameWon" ,
66+ color = "#CE1141" ,
67+ legend = "Rockets" ,
68+ source = standings_cds ,
69+ view = rockets_view ,
70+ )
71+ west_fig .step (
72+ "stDate" ,
73+ "gameWon" ,
74+ color = "#006BB6" ,
75+ legend = "Warriors" ,
76+ source = standings_cds ,
77+ view = warriors_view ,
78+ )
4979
5080# Move the legend to the upper left corner
51- east_fig .legend .location = ' top_left'
52- west_fig .legend .location = ' top_left'
81+ east_fig .legend .location = " top_left"
82+ west_fig .legend .location = " top_left"
0 commit comments