Repository: wright-group/WrightTools

Issue:
Contours in mpl_2D seem to have shape problem. 
I'm running the following script
```
import WrightTools as wt

p = '000.data'
d = wt.data.from_PyCMDS(p)
d.signal_ratio.clip(zmin=-4, zmax=4)
d.signal_ratio.znull = 0
d.signal_ratio.signed = True
d.signal_ratio._update()

art = wt.artists.mpl_2D(d)
art.plot(channel='signal_ratio', contours=9)
```
using the dataset found in `'Google Drive/MX2/CMDS/2017-08-07/p-CMDS-p/0ps 51 [w2, w1]'`. I get the following error.
```
Traceback (most recent call last):

  File "<ipython-input-98-92c093c4abb1>", line 1, in <module>
    runfile('/Users/darienmorrow/Google Drive/MX2/CMDS/2017-08-07/p-CMDS-p/0ps 51 [w2, w1]/workup.py', wdir='/Users/darienmorrow/Google Drive/MX2/CMDS/2017-08-07/p-CMDS-p/0ps 51 [w2, w1]')

  File "/Users/darienmorrow/anaconda/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 866, in runfile
    execfile(filename, namespace)

  File "/Users/darienmorrow/anaconda/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 102, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "/Users/darienmorrow/Google Drive/MX2/CMDS/2017-08-07/p-CMDS-p/0ps 51 [w2, w1]/workup.py", line 15, in <module>
    art.plot(channel='signal_ratio', contours=9, contours_local=False)

  File "/Users/darienmorrow/source/WrightTools/WrightTools/artists.py", line 1858, in plot
    subplot_main.contour(X, Y, zi, contours_levels, colors='k')

  File "/Users/darienmorrow/anaconda/lib/python3.6/site-packages/matplotlib/__init__.py", line 1892, in inner
    return func(ax, *args, **kwargs)

  File "/Users/darienmorrow/anaconda/lib/python3.6/site-packages/matplotlib/axes/_axes.py", line 5819, in contour
    contours = mcontour.QuadContourSet(self, *args, **kwargs)

  File "/Users/darienmorrow/anaconda/lib/python3.6/site-packages/matplotlib/contour.py", line 864, in __init__
    self._process_args(*args, **kwargs)

  File "/Users/darienmorrow/anaconda/lib/python3.6/site-packages/matplotlib/contour.py", line 1429, in _process_args
    x, y, z = self._contour_args(args, kwargs)

  File "/Users/darienmorrow/anaconda/lib/python3.6/site-packages/matplotlib/contour.py", line 1508, in _contour_args
    x, y, z = self._check_xyz(args[:3], kwargs)

  File "/Users/darienmorrow/anaconda/lib/python3.6/site-packages/matplotlib/contour.py", line 1566, in _check_xyz
    "{0} instead of {1}.".format(x.shape, z.shape))

TypeError: Shape of x does not match that of z: found (52, 52) instead of (51, 51).
```



Discussion:
Does it previously call pcolor helper? 
Pcolor and contour are set up for different (off by one in each dimension) shapes


@ksunden Turns out that if you use the kwarg `pixelated = False` (which calls contourf) then the contours work out fine. So yes, I think it is that pcolor helper adds the +1 to each dimension. 
Okay, this is big that should be fixed, still, but sounds like we have a pretty clear solution that is needed

Resolving patch:
diff --git a/WrightTools/artists.py b/WrightTools/artists.py
--- a/WrightTools/artists.py
+++ b/WrightTools/artists.py
@@ -1884,6 +1884,8 @@ def plot(self, channel=0,
                 plt.plot([diag_min, diag_max], [diag_min, diag_max], 'k:')
             # contour lines -----------------------------------------------------------------------
             if contours:
+                # Ensure that X, Y are that expected by contour, not pcolor
+                X, Y = np.meshgrid(self.xaxis.points, self.yaxis.points)
                 if contours_local:
                     # force top and bottom contour to be just outside of data range
                     # add two contours


Test patch: