Skip to content

Commit d849477

Browse files
fix(bokeh): address review feedback for lollipop-basic
Attempt 1/3 - fixes based on AI review - SC-04: add '· python ·' to title (was missing language component) - DE-02: remove full rectangular outline border; rely on axis_line_color for L-spine - DE-01: add 'Avg: $34.7K' text label to the average reference line
1 parent b7eeb3e commit d849477

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

  • plots/lollipop-basic/implementations/python

plots/lollipop-basic/implementations/python/bokeh.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" anyplot.ai
1+
"""anyplot.ai
22
lollipop-basic: Basic Lollipop Chart
33
Library: bokeh 3.9.1 | Python 3.13.14
44
Quality: 88/100 | Updated: 2026-07-01
@@ -18,7 +18,7 @@
1818
from pathlib import Path
1919

2020
from bokeh.io import output_file, save
21-
from bokeh.models import ColumnDataSource, NumeralTickFormatter, Range1d, Span
21+
from bokeh.models import ColumnDataSource, Label, NumeralTickFormatter, Range1d, Span
2222
from bokeh.plotting import figure
2323
from PIL import Image
2424
from selenium import webdriver
@@ -67,7 +67,7 @@
6767
height=1800,
6868
x_range=categories,
6969
y_range=Range1d(0, 108000),
70-
title="lollipop-basic · bokeh · anyplot.ai",
70+
title="lollipop-basic · python · bokeh · anyplot.ai",
7171
x_axis_label="Cloud Service",
7272
y_axis_label="Monthly Spend (USD)",
7373
toolbar_location=None,
@@ -77,8 +77,21 @@
7777
min_border_right=80,
7878
)
7979

80-
# Average reference line
80+
# Average reference line + label
8181
p.add_layout(Span(location=avg_spend, dimension="width", line_color=INK_MUTED, line_width=3, line_dash="dashed"))
82+
p.add_layout(
83+
Label(
84+
x=2880,
85+
y=avg_spend, # screen x from plot-frame left; plot area = 3200-180-80=2940px wide
86+
x_units="screen",
87+
text=f"Avg: ${avg_spend / 1000:.1f}K",
88+
text_font_size="22pt",
89+
text_color=INK_MUTED,
90+
text_align="right",
91+
text_baseline="bottom",
92+
y_offset=8,
93+
)
94+
)
8295

8396
# Stems
8497
p.segment(x0="categories", y0="zeros", x1="categories", y1="values", source=source, line_width=4, color=BRAND)
@@ -132,7 +145,7 @@
132145
# Background and chrome
133146
p.background_fill_color = PAGE_BG
134147
p.border_fill_color = PAGE_BG
135-
p.outline_line_color = INK_SOFT
148+
p.outline_line_color = None # L-spine only: x/y axis_line_color handle bottom+left
136149

137150
# Y-axis tick format
138151
p.yaxis.formatter = NumeralTickFormatter(format="$0,0")

0 commit comments

Comments
 (0)