X Tutup
Skip to content

Bug: matplotlib.pyplot.spy: does not work correctly for sparse matrices with many entries (>= 2**32) #6368

@jor-

Description

@jor-

matplotlib.pyplot.spy does not work correctly for sparse matrices with a large number of entries (>= 2**32). I would guess it has something to do with the value range of int32.

An example that reproduces the bug is:

import numpy as np
import scipy.sparse
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
n = 16
s = 2**n
A = scipy.sparse.coo_matrix(np.ones((s,s), dtype=np.int8))
plt.spy(A)
file = '/tmp/spy_{}.png'.format(n)
plt.savefig(file)

For n = 16, spy shows only some entries.
spy_16
For n = 15 it works correctly.
spy_15

I have used Matplotlib 1.5.1 installed over pip with Python 3.5.1 on Linux.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup