Plot x, y, z as expected with correct axis labels.

    Examples
    --------
    >>> import matplotlib.pyplot as plt
    >>> import numpy as np
    >>> from reda.plotters import matplot
    >>> a = np.arange(4)
    >>> b = np.arange(3) + 3
    >>> def sum(a, b):
    ...    return a + b
    >>> x, y = np.meshgrid(a, b)
    >>> c = sum(x, y)
    >>> fig, (ax1, ax2) = plt.subplots(1, 2)
    >>> im = ax1.pcolormesh(x, y, c)
    >>> _ = plt.colorbar(im, ax=ax1)
    >>> _ = ax1.set_title("plt.pcolormesh")
    >>> _, _ = matplot(x, y, c, ax=ax2)
    >>> _ = ax2.set_title("reda.plotters.matplot")
    >>> fig.show()

    Note
    ----
    Only works for equidistant data at the moment.

def matplot(x, y, z, ax=None, colorbar=True, **kwargs):
    """ Plot x, y, z as expected with correct axis labels.

    Examples
    --------
    >>> import matplotlib.pyplot as plt
    >>> import numpy as np
    >>> from reda.plotters import matplot
    >>> a = np.arange(4)
    >>> b = np.arange(3) + 3
    >>> def sum(a, b):
    ...    return a + b
    >>> x, y = np.meshgrid(a, b)
    >>> c = sum(x, y)
    >>> fig, (ax1, ax2) = plt.subplots(1, 2)
    >>> im = ax1.pcolormesh(x, y, c)
    >>> _ = plt.colorbar(im, ax=ax1)
    >>> _ = ax1.set_title("plt.pcolormesh")
    >>> _, _ = matplot(x, y, c, ax=ax2)
    >>> _ = ax2.set_title("reda.plotters.matplot")
    >>> fig.show()

    Note
    ----
    Only works for equidistant data at the moment.
    """
    xmin = x.min()
    xmax = x.max()
    dx = np.abs(x[0, 1] - x[0, 0])

    ymin = y.min()
    ymax = y.max()
    dy = np.abs(y[1, 0] - y[0, 0])

    x2, y2 = np.meshgrid(
        np.arange(xmin, xmax + 2 * dx, dx) - dx / 2.,
        np.arange(ymin, ymax + 2 * dy, dy) - dy / 2.)

    if not ax:
        fig, ax = plt.subplots()
    else:
        fig = ax.figure

    im = ax.pcolormesh(x2, y2, z, **kwargs)
    ax.axis([x2.min(), x2.max(), y2.min(), y2.max()])
    ax.set_xticks(np.arange(xmin, xmax + dx, dx))
    ax.set_yticks(np.arange(ymin, ymax + dx, dy))

    if colorbar:
        cbar = fig.colorbar(im, ax=ax)
    else:
        cbar = None

    return ax, cbar