Skip to content

Commit 6d27e9f

Browse files
Update line-and-scatter.md
1 parent 5469864 commit 6d27e9f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

doc/python/line-and-scatter.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ def negative_1_if_count_is_odd(count):
306306

307307
def swarm(
308308
X_series,
309+
fig_title,
309310
point_size=16,
310311
fig_width=800,
311312
gap_multiplier=1.2,
@@ -372,7 +373,6 @@ def swarm(
372373
# in px.
373374
row["y"] = (row["y_slot"]//2) * \
374375
negative_1_if_count_is_odd(row["y_slot"])*point_size*gap_multiplier
375-
print(row["y"])
376376

377377
# if the number of points is even, move y-coordinates down to put an equal
378378
# number of entries above and below the axis
@@ -392,6 +392,7 @@ def swarm(
392392
df,
393393
x="x",
394394
y="y",
395+
title=fig_title,
395396
)
396397
# we want to suppress the y coordinate in the hover value because the
397398
# y-coordinate is irrelevant/misleading
@@ -413,9 +414,10 @@ def swarm(
413414

414415

415416
df = px.data.iris() # iris is a pandas DataFrame
416-
fig = swarm(df["sepal_length"])
417-
# here's a more interesting test case for collision avoidance:
418-
#fig = swarm(pd.Series([1, 1.5, 1.78, 1.79, 1.85, 2,
417+
fig = swarm(df["sepal_length"], "Sepal length distribution from 150 iris samples")
418+
# The iris data set entries are rounded so there are no collisions.
419+
# a more interesting test case for collision avoidance is:
420+
# fig = swarm(pd.Series([1, 1.5, 1.78, 1.79, 1.85, 2,
419421
# 2, 2, 2, 3, 3, 2.05, 2.1, 2.2, 2.5, 12]))
420422
fig.show()
421423
```

0 commit comments

Comments
 (0)