8000 Hexbin if singular and mincnt used · Issue #16461 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
Hexbin if singular and mincnt used #16461
Closed
@gunthergl

Description

@gunthergl

Bug report

Bug summary

Related to #3038, #2863 and this stackoverflow bug: if only identical (or one single) points are given,

This seems to still be a bug when using mincnt > 0

Code for reproduction

import numpy as np
import matplotlib.pyplot as plt

mytens = [np.array([[-1, 1], [1, 1]]),
          np.array([[-1, 1], [-1, -1], [-1, -1]]),
          np.array([[-1, 1]])]
fig, axs = plt.subplots(nrows=2, ncols=2, sharex="all", sharey="all", squeeze=False)
axs[0, 0].hexbin(
    x=mytens[0][:, 0],
    y=mytens[0][:, 1],
    mincnt=1,
    gridsize=4
)
axs[0, 0].set_title("correct point 1")
axs[0, 1].hexbin(
    x=mytens[1][:, 0],
    y=mytens[1][:, 1],
    mincnt=1,
    gridsize=4
)
axs[0, 1].set_title("correct point 2")
axs[1, 0].hexbin(
    x=mytens[2][:, 0],
    y=mytens[2][:, 1],
    mincnt=1,
    gridsize=4
)
axs[1, 0].set_title("actual point not plotted, instead at 0,0!")
axs[1, 1].hexbin(
    x=mytens[2][:, 0],
    y=mytens[2][:, 1],
    # mincnt=0,  # if not given, 0 is assigned internally
    gridsize=4
)
axs[1, 1].set_title("actual point plotted, expected behaviour")
plt.show()

Actual outcome

removeme

Expected outcome

Point on the bottom left should be on the left top. The plotted point (0,0) does not even exist in the given data.

Matplotlib version

  • Operating system: Win 10
  • Matplotlib version: 3.1.3
  • Matplotlib backend (print(matplotlib.get_backend())): Qt5Agg
  • Python version: 3.7.6
  • Jupyter version (if applicable): -
  • Other libraries:
    • numpy 1.18.1
    • (But same problem with torch)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0