-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Closed
Milestone
Description
Bug summary
Looking at LineCollection docstring, one can read: “All parameters must be sequences or scalars” so I would expect passing a sequence of zorder values to be fine. Unfortunately, it does not seem to be working and it looks like the lines zorder correspond to their ”index” in the collection.
Code for reproduction
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection
ll = LineCollection([((0, 0), (1, 1)), # tilted line
((0.2, 0), (0.2, 1)), # vertical line
((0, 0.5), (1, 0.5))], # horizontal line
colors=['r', 'g', 'b'], zorder=[5, 10, 2], linewidths=10)
fig, ax = plt.subplots()
ax.add_collection(ll)
plt.show()
print(ll.get_zorder()) # [5, 10, 2] so the expected result is:
# vertical green > oblique red > horizontal blue
# fig.savefig('expecting_green_over_red_over_blue.png')Expected outcome
Based on the passed and returned zorder values, one would expect:
vertical green > oblique red > horizontal blue
Matplotlib version
Tested on Matplotlib 2.0.0.post3871+gf9e0b92 from GitHub and 1.5.1 from conda, on Linux (CentOS 7) and with Python 2.7.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
