Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fixed incorrect colour in ErrorBar when Nan value is presented#16724

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
timhoffm merged 5 commits intomatplotlib:masterfromCSCD01-team20:Fix-13799
Mar 22, 2020
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 22 additions & 14 deletionslib/matplotlib/axes/_axes.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1122,15 +1122,19 @@ def hlines(self, y, xmin, xmax, colors='k', linestyles='solid',
if not np.iterable(xmax):
xmax = [xmax]

y, xmin, xmax = cbook.delete_masked_points(y, xmin, xmax)

# Create and combine masked_arrays from input
y, xmin, xmax = cbook._combine_masks(y, xmin, xmax)
y = np.ravel(y)
xmin = np.resize(xmin, y.shape)
xmax = np.resize(xmax, y.shape)
xmin = np.ravel(xmin)
xmax = np.ravel(xmax)

masked_verts = np.ma.empty((len(y), 2, 2))
masked_verts[:, 0, 0] = xmin
masked_verts[:, 0, 1] = y
masked_verts[:, 1, 0] = xmax
masked_verts[:, 1, 1] = y

verts = [((thisxmin, thisy), (thisxmax, thisy))
for thisxmin, thisxmax, thisy in zip(xmin, xmax, y)]
lines = mcoll.LineCollection(verts, colors=colors,
lines = mcoll.LineCollection(masked_verts, colors=colors,
linestyles=linestyles, label=label)
self.add_collection(lines, autolim=False)
lines.update(kwargs)
Expand DownExpand Up@@ -1200,15 +1204,19 @@ def vlines(self, x, ymin, ymax, colors='k', linestyles='solid',
if not np.iterable(ymax):
ymax = [ymax]

x, ymin, ymax = cbook.delete_masked_points(x, ymin, ymax)

# Create and combine masked_arrays from input
x, ymin, ymax = cbook._combine_masks(x, ymin, ymax)
x = np.ravel(x)
ymin = np.resize(ymin, x.shape)
ymax = np.resize(ymax, x.shape)
ymin = np.ravel(ymin)
ymax = np.ravel(ymax)

masked_verts = np.ma.empty((len(x), 2, 2))
masked_verts[:, 0, 0] = x
masked_verts[:, 0, 1] = ymin
masked_verts[:, 1, 0] = x
masked_verts[:, 1, 1] = ymax

verts = [((thisx, thisymin), (thisx, thisymax))
for thisx, thisymin, thisymax in zip(x, ymin, ymax)]
lines = mcoll.LineCollection(verts, colors=colors,
lines = mcoll.LineCollection(masked_verts, colors=colors,
linestyles=linestyles, label=label)
self.add_collection(lines, autolim=False)
lines.update(kwargs)
Expand Down
18 changes: 18 additions & 0 deletionslib/matplotlib/tests/test_axes.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3992,6 +3992,24 @@ def test_hlines():
ax5.set_ylim(0, 15)


@pytest.mark.parametrize('data', [[1, 2, 3, np.nan, 5],
np.ma.masked_equal([1, 2, 3, 4, 5], 4)])
@check_figures_equal(extensions=["png"])
def test_lines_with_colors(fig_test, fig_ref, data):
test_colors = ['red', 'green', 'blue', 'purple', 'orange']
fig_test.add_subplot(2, 1, 1).vlines(data, 0, 1,
colors=test_colors, linewidth=5)
fig_test.add_subplot(2, 1, 2).hlines(data, 0, 1,
colors=test_colors, linewidth=5)

expect_xy = [1, 2, 3, 5]
expect_color = ['red', 'green', 'blue', 'orange']
fig_ref.add_subplot(2, 1, 1).vlines(expect_xy, 0, 1,
colors=expect_color, linewidth=5)
fig_ref.add_subplot(2, 1, 2).hlines(expect_xy, 0, 1,
colors=expect_color, linewidth=5)


@image_comparison(['step_linestyle', 'step_linestyle'], remove_text=True)
def test_step_linestyle():
x = y = np.arange(10)
Expand Down

[8]ページ先頭

©2009-2026 Movatter.jp