Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Let _pcolorargs check C for consistency with X and Y; closes #1688 #2063

Merged
merged 3 commits into from

3 participants

@efiring
Owner

This is a minimal change to close #1688.

@mdboom
Owner

Looks good. Understanding that _pcolorargs is a private method, it still might be nice to document the purpose of the allmatch kwarg in a comment.

@efiring
Owner

There is an unrelated Travis test failure on Python 3.3. I think this is ready to merge.

@pelson pelson commented on the diff
lib/matplotlib/axes.py
@@ -7339,6 +7361,15 @@ def _pcolorargs(self, funcname, *args):
raise TypeError(
'Incompatible X, Y inputs to %s; see help(%s)' % (
funcname, funcname))
+ if allmatch:
+ if not (Nx == numCols and Ny == numRows):
+ raise TypeError('Dimensions of C are incompatible with'
@pelson Collaborator
pelson added a note

These exceptions are probably going to be quite common. I wonder if it is worth making them slightly better by providing some shape information?

I see that they are TypeErrors for consistency, but maybe they should be ValueErrors instead...

@efiring Owner
efiring added a note

@pelson, "yes" to both of these comments. I considered the change to ValueError, but decided that was best left for a later PR, first because it could break user code, and second because I think this is not the only place where that switch should be made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@pelson pelson commented on the diff
lib/matplotlib/tests/test_axes.py
@@ -662,6 +663,20 @@ def test_pcolormesh():
ax = fig.add_subplot(133)
ax.pcolormesh(Qx,Qz,Z, shading="gouraud")
+def test_pcolorargs():
@pelson Collaborator
pelson added a note

Might be time to start a test_pseudo_color module. Not in this PR though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@pelson pelson commented on the diff
lib/matplotlib/tests/test_transforms.py
((19 lines not shown))
ax.contourf(np.arange(48).reshape(6, 8), transform=times10 + ax.transData)
-
- ax.pcolormesh(np.linspace(0, 4, 7),
- np.linspace(5.5, 8, 9),
- np.arange(48).reshape(6, 8),
+
+ ax.pcolormesh(np.linspace(0, 4, 7),
+ np.linspace(5.5, 8, 9),
+ np.arange(48).reshape(8, 6),
@pelson Collaborator
pelson added a note

This kind of thing could be quite a common problem. doh on my behalf :wink:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@pelson
Collaborator

:+1: from me.

@mdboom mdboom merged commit 9d5e9ee into from
@mdboom
Owner

I have merged this manually with the additional information in the error message as suggested by @pelson.

@mdboom
Owner

FYI: Merge commit is 7e49a5e

@efiring efiring deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 24, 2013
  1. @efiring
  2. @efiring

    Fix error in test_pre_transform_plotting.

    efiring authored
    This error was revealed by the new checking in _pcolorargs.
Commits on May 25, 2013
  1. @efiring
Something went wrong with that request. Please try again.