Skip to content

pcolormesh bug: edgecolor ignored #1302

Description

@bblay

I believe the following code should produce grey edges but they have colour.

import numpy as np
import matplotlib.pyplot as plt

plt.pcolormesh(np.arange(12).reshape(4, 3), edgecolor='#888888', facecolor='none')
plt.show()

Activity

  1. dmcdougall commented on Sep 24, 2012

    @dmcdougall
    Member

    @bblay Thanks for pointing this out.

    pcolormesh(np.arange(12).reshape(4, 3), edgecolors='b', facecolor='g') produces faces that are not all green, but all the edges are blue.

  2. WeatherGod commented on Sep 24, 2012

    @WeatherGod
    Member

    Note the difference: "edgecolor" and "edgecolors"

  3. WeatherGod commented on Sep 24, 2012

    @WeatherGod
    Member

    In other words, the bug probably is that we aren't triggering an error for passing in "edgecolor", since the documentation states that it should be "edgecolors".

  4. WeatherGod commented on Sep 24, 2012

    @WeatherGod
    Member

    Also, I would imagine that "facecolor" makes no sense for the pcolor family of functions, but that is just my own opinion. "facecolor" is not mentioned in the documentation for those functions, AFAICT.

  5. pelson commented on Sep 25, 2012

    @pelson
    Member

    Confirmed. The following code fails to produce a quadmesh with red edges:

    c = plt.pcolormesh(np.arange(12).reshape(4, 3), edgecolors='red', facecolors='none')
    

    (they are colored by the data).

    Workaround:

    c._is_stroked = False
    

    There are some fundamental flaws with the way this has been implemented, and fixing them will break existing code.
    It doesn't appear that this has worked since at least 1.0 (unable to test before then).

    I suggest that this goes into the known bugs milestone for 1.2, and we address it in 1.3.

    @mdboom & @efiring : I think you two have most exposure to the QuadMesh collection; do you agree with this, or would you like me to fix this and slip it in to 1.2? (I could have a PR ready in <24 hrs)

    Full disclosure: @bblay and I are colleagues.

  6. tacaswell commented on Jan 16, 2014

    @tacaswell
    Member

    This is still an issue on master. Tagged an 1.4, but this is a candidate to slip to 1.5 as it never seems to have worked.

  7. modified the milestones: v1.4.x, v1.4.0 on Apr 27, 2014
  8. tacaswell commented on Apr 27, 2014

    @tacaswell
    Member

    punting (again)

  9. efiring commented on Apr 27, 2014

    @efiring
    Member

    @pelson do you remember what your proposed fix was, and what it would break? And what were the "fundamental flaws"? I suspect we should have taken you up on your offer to generate a PR.

  10. pelson commented on Apr 28, 2014

    @pelson
    Member

    Unfortunately I don't. Logically it seems that an edgecolor of 'none', 'face', a specific color or an array are all supportable behaviour which should work. It might be worth investigating again and putting forward a proposed solution.

  11. modified the milestones: v1.4.x, on Feb 7, 2015
  12. modified the milestones: , on Jul 17, 2015
  13. doylejg commented on Nov 27, 2015

    @doylejg

    Just confirming this bug in 1.4.3, has this been fixed in 1.5.0?

  14. efiring commented on Nov 27, 2015

    @efiring
    Member

    Both pcolormesh and pcolor use colormapping based on the input array for the edges when the facecolor='none', regardless of the setting of edgecolors. I note that 'facecolor' is not in the docstrings; it is simply being passed on the Collection. It sounds like the desired behavior would be for the facecolor='none' case to be trapped and used to defeat the colormapping of edges when edgecolors is also specified.

  15. modified the milestones: , on Oct 3, 2017
  16. added
    🌱 Good first issueOpen a pull request against these issues if there are no active ones!
    on Apr 12, 2018
  17. removed this from the future releases milestone on Oct 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions