Skip to content

Commit

Permalink
simplifying counter variable in enumeration loop
Browse files Browse the repository at this point in the history
  • Loading branch information
hmd101 committed Oct 16, 2024
1 parent 424bf70 commit 79620e2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions docs/scripts/conceptual_intro.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,6 @@ def matched_light():
matched_light_weights = CONES_MATRIX @ matched_light
x = np.arange(len(random_light_weights))
# from https://matplotlib.org/stable/gallery/lines_bars_and_markers/barchart.html
multiplier = 0
width = 0.4
styles = [
{
Expand All @@ -414,8 +413,8 @@ def matched_light():
labels = ["Random light", "Matched light"]
weights = [random_light_weights, matched_light_weights]

for i, (name, wts, sty) in enumerate(zip(labels, weights, styles)):
offset = width * (multiplier + i)
for multiplier, (name, wts, sty) in enumerate(zip(labels, weights, styles)):
offset = width * multiplier
axes[1].bar(x + offset, wts, label=name, width=width, **sty)

axes[1].set(
Expand Down

0 comments on commit 79620e2

Please sign in to comment.