Spaces:
Sleeping
Sleeping
Update dashboard.py
Browse files- dashboard.py +14 -24
dashboard.py
CHANGED
@@ -416,32 +416,22 @@ def legend_hook(plot, element):
|
|
416 |
'''
|
417 |
|
418 |
def create_overlay_plots(df):
|
419 |
-
|
420 |
def move_legend_below(plot, element):
|
421 |
p = plot.state
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
# Number of columns
|
437 |
-
try:
|
438 |
-
leg.columns = 8 # works in Bokeh 3.x
|
439 |
-
except Exception:
|
440 |
-
pass
|
441 |
-
|
442 |
-
# Remove it from its current location and re-add below
|
443 |
-
p.legend = []
|
444 |
-
p.add_layout(leg,'below')
|
445 |
|
446 |
|
447 |
|
|
|
416 |
'''
|
417 |
|
418 |
def create_overlay_plots(df):
|
|
|
419 |
def move_legend_below(plot, element):
|
420 |
p = plot.state
|
421 |
+
if p.legend:
|
422 |
+
legend = p.legend[0]
|
423 |
+
legend.orientation = 'horizontal'
|
424 |
+
legend.location = 'center' # center of the below layout, not plot area
|
425 |
+
legend.ncols = 8
|
426 |
+
legend.background_fill_color = 'white'
|
427 |
+
legend.border_line_color = 'black'
|
428 |
+
legend.label_text_font_size = '12pt'
|
429 |
+
legend.label_text_color = 'black'
|
430 |
+
legend.spacing = 10
|
431 |
+
legend.margin = 10
|
432 |
+
legend.label_standoff = 5
|
433 |
+
|
434 |
+
p.add_layout(legend, 'below')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
435 |
|
436 |
|
437 |
|