Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cb0467d

Browse files
committed
prettify instantiation of Linecollection obj even further
1 parent 2da662b commit cb0467d

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

examples/pylab_examples/line_collection.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,10 @@
3030
# where onoffseq is an even length tuple of on and off ink in points.
3131
# If linestyle is omitted, 'solid' is used
3232
# See matplotlib.collections.LineCollection for more information
33-
line_segments = LineCollection(segs,
34-
linewidths=(0.5, 1, 1.5, 2),
35-
colors=[colorConverter.to_rgba(i)
36-
for i in ('b', 'g', 'r', 'c',
37-
'm', 'y', 'k')],
38-
linestyle='solid')
33+
colors = [colorConverter.to_rgba(i) for i in 'bgrcmyk']
34+
35+
line_segments = LineCollection(segs, linewidths=(0.5, 1, 1.5, 2),
36+
colors=colors, linestyle='solid')
3937
ax.add_collection(line_segments)
4038
ax.set_title('Line collection with masked arrays')
4139
plt.show()

0 commit comments

Comments
 (0)