X Tutup
Skip to content

Isolated points missing in pdf #7293

@peterchenchenchen

Description

@peterchenchenchen

Dear developers,
when plotting single points surrounded by np.nan values, points are shown in a regular plot, but are omitted when saved via pdf backend. Minimal example:

import numpy as np
import matplotlib.pyplot as plt

a = np.array([1,np.nan,2,np.nan,3,3.5,4])

plt.plot(a, marker='o')
plt.show()

generates a perfect plot with the 5 points shown:

foo1

but directly saving it via pdf backend omitts the values isolated by np.nans:

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.backends.backend_pdf as pdf

a = np.array([1,np.nan,2,np.nan,3,3.5,4])

fig1 = plt.figure()
sub  = fig1.add_subplot(1,1,1)
sub.plot(a,marker='o')
pp1  = pdf.PdfPages('foo.pdf')
fig1.savefig(pp1, format='pdf')
pp1.close()

like so:

foo2

I would be glad for any help.

System:
Ubuntu 14.02
Python 2.7.6
Numpy 1.11.2
Matplotlib 1.5.3

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    X Tutup