Skip to content

Tiles seem to overlap in zoomed out hexbin #7841

Closed

Description

@dstansby

When looking at a zoomed out hexbin plot, the tiles seem to overlap, with the right-most tiles lying on top of the left-most tiles. This is present on master (see http://matplotlib.org/devdocs/_images/hexbin_demo.png), and here is an example (it helps to zoom into the .png image):

screenshot from 2017-01-16 13-27-39

Activity

  1. modified the milestones: , on Jan 16, 2017
  2. tacaswell commented on Jan 16, 2017

    @tacaswell
    Member

    This also happen in 2.0.0rc2

    http://matplotlib.org/2.0.0rc2/_images/hexbin_demo.png

    However this is not a regression, it has been like this for a long time: http://matplotlib.org/1.2.1/_images/hexbin_demo.png

  3. efiring commented on Jan 16, 2017

    @efiring
    Member

    This is the ever-present problem of filling adjacent patches--the same as the problems with contourf. If the edges are not stroked at all, there are light artifacts. If the edges are stroked, as has always been the choice in hexbin, then the patches overlap, which is what is we see here. Turning anti-aliasing on or off modifies the artifacts, and their behavior also changes depending on alpha, but the upshot is that we have never found a solution for this problem. It seems to be a general problem with renderers. For hexbin, using a thin edgewidth helps.

  4. modified the milestones: , on May 3, 2017
  5. anntzer commented on Jun 29, 2017

    @anntzer
    Contributor

    https://lists.cairographics.org/archives/cairo/2007-July/011098.html may be relevant (to explain the issue, not to solve it).

  6. anntzer commented on Jul 10, 2017

    @anntzer
    Contributor

    It may be possible to fix this issue by drawing the hexbin as a quadmesh rather than a polycollection.

  7. efiring commented on Jul 10, 2017

    @efiring
    Member

    I don't think so. First, hexagons are not quadrilaterals. Second, the quadmesh is not immune to the adjacent patch rendering problems.

  8. anntzer commented on Jul 10, 2017

    @anntzer
    Contributor
    1. A hexagon can be represented as two quadrilaterals (in fact, splitting each hexagon in a top and a bottom half actually gives you a proper quadmesh).
    2. I see no seams in https://files.gitter.im/matplotlib/matplotlib/9dTT/default-quadmesh.png (produced by Agg), so I assume that Agg (and cairo) do have special handling for them. (At least on cairo's side, the entire quadmesh is defined before rendering, so it should have all the info to compute the seams between the quads.)
  9. efiring commented on Jul 10, 2017

    @efiring
    Member
    1. Yes, of course one can do this.
    2. The Agg rendering seems to work well with and without antialiasing, provided alpha is 1. It does not do so well with alpha = 0.3, for example. Still, an improvement for the alpha=1 case is worthwhile, so I like your idea.
      alpha3
  10. efiring commented on Jul 10, 2017

    @efiring
    Member

    It seems there is an inaccuracy in agg quadmesh, though:

    x = np.arange(4)
    y = np.arange(3)
    z = np.arange(6).reshape(2, 3)
    X, Y = np.meshgrid(x, y)
    pcolormesh(X+Y, X-Y, z)
    savefig('skewed.png')

    All of the corners are slightly chopped off, with the top corner being the most obvious.
    skewed

  11. modified the milestones: , on Jul 10, 2017
  12. self-assigned this
    on Jun 3, 2021
  13. QuLogic commented on Mar 4, 2023

    @QuLogic
    Member

    Closing as duplicate of #1188.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions