Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Contour does not pass a list of linestyles to LineCollection #1704

Closed
wants to merge 1 commit into from

3 participants

Michael Droettboom Eric Firing Damon McDougall
Michael Droettboom
Owner

This is a possible fix for #1701. The LineCollection constructor's linestyle/linestyles kwarg expects a list of styles, but contour was passing it a single value.

Michael Droettboom
Owner

@efiring may want to look at this.

Michael Droettboom
Owner

Also: this will need a unit test before merging.

Eric Firing
Owner

It looks like that helps; but the whole business of setting dash patterns (a tuple within a tuple), together with the question of when one needs a list versus when one can get by with a single value, remains a confusing mess. And if one makes an error, it can trigger an incomprehensible PYCXX error message.
It looks like LineCollection.set_linestyle() works with a single value (as implied by the name) for strings, but not for those ugly dash specifications. In retrospect, we probably should have chosen a string syntax for the dash specification, so that linestyle(s) would always be a string or a sequence of strings. That would also allow a simpler specification for the usual case in which one doesn't need the offset part of the specification.

Damon McDougall
Collaborator

Superceded by #1718.

Damon McDougall dmcdougall closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 25, 2013
  1. Michael Droettboom
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/matplotlib/contour.py
2  lib/matplotlib/contour.py
View
@@ -854,7 +854,7 @@ def __init__(self, ax, *args, **kwargs):
col = mcoll.LineCollection(segs,
antialiaseds=aa,
linewidths=width,
- linestyle=lstyle,
+ linestyle=[lstyle],
alpha=self.alpha,
transform=self.get_transform(),
zorder=zorder)
Something went wrong with that request. Please try again.