Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Errorbar caps missing in master when saving to PDF #4239

Closed
@u55

Description

@u55

Hi matplotlib developers,

While working with master, I discovered that the errorbar caps are sometimes missing when saving a figure to PDF. Here is a minimal working example:

import numpy as np
import matplotlib.pyplot as plt

N = 6

plt.figure()
# Caps are drawn
plt.errorbar(np.arange(N),
             np.ones(N),
             np.ones(N),
             )
# Caps are missing
plt.errorbar(np.arange(N+1),
             np.ones(N+1) + 4,
             np.ones(N+1),
             )
plt.xlim(-1,N+1)
plt.ylim(-1,7)
plt.savefig('bug.pdf')

Tested with python 2.7 in Linux with matplotlib master. The bug only shows up in master, version 1.4.3 is working correctly. Strangely, this bug does not show up in other vector backends, such as svg, eps, or ps. Stranger still, the appearance of the errorbar caps seems to depend on the number of points that are being drawn. In the above example, 6 points is the magic number to see caps, while the caps are missing if the arrays are extended to 7 points.

As always, thanks for the help.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions