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

Appearance settings

Apply asanyarray to arguments for pcolor and family #5206

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 5, 2015
Merged
Show file tree
Hide file tree
Changes from all 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
Apply asanyarray to arguments for pcolor and family
  • Loading branch information
WeatherGod committed Oct 7, 2015
commit df6e1accbd57ee6f44ae01edc7134069939f0b0a
4 changes: 2 additions & 2 deletions 4 lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4982,7 +4982,7 @@ def _pcolorargs(funcname, *args, **kw):
allmatch = kw.pop("allmatch", False)

if len(args) == 1:
C = args[0]
C = np.asanyarray(args[0])
numRows, numCols = C.shape
if allmatch:
X, Y = np.meshgrid(np.arange(numCols), np.arange(numRows))
Expand All @@ -4992,7 +4992,7 @@ def _pcolorargs(funcname, *args, **kw):
return X, Y, C

if len(args) == 3:
X, Y, C = args
X, Y, C = [np.asanyarray(a) for a in args]
numRows, numCols = C.shape
else:
raise TypeError(
Expand Down
15 changes: 15 additions & 0 deletions 15 lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,21 @@ def test_symlog2():
ax.set_ylim(-0.1, 0.1)


@cleanup
def test_pcolorargs():
# Smoketest to catch issue found in gh:5205
x = [-1.5, -1.0, -0.5, 0.0, 0.5, 1.0, 1.5]
y = [-1.5, -1.25, -1.0, -0.75, -0.5, -0.25, 0,
0.25, 0.5, 0.75, 1.0, 1.25, 1.5]
X, Y = np.meshgrid(x, y)
Z = np.hypot(X, Y)

plt.pcolor(Z)
plt.pcolor(list(Z))
plt.pcolor(x, y, Z)
plt.pcolor(X, Y, list(Z))


@image_comparison(baseline_images=['pcolormesh'], remove_text=True)
def test_pcolormesh():
n = 12
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.