def img(im, x=None, y=None, xlim=None, ylim=None, clim=[None, None], cmin=0,
    xinvert=False, yinvert=False, cbar_invert=False, clog=None, title=None,
    xlabel=None, ylabel=None, clabel=None, lab_loc=0, ax=None, grid=None,
    plot_kw={}, **kwargs):
    """2D pixel-based image plotting function.
	
	Parameters
	----------
	im : array-like
		Value for each pixel in an x-y 2D array, where the first dimension is the x-position and the second is
		the y-position.
	x : array-like, optional
		Position of data points in the x axis.
	y : array-like, optional
		Position of data points in the y axis.
	xlim : tuple-like, optional
		Defines the limits of the x-axis, it must contain two elements (lower and higer limits).
	ylim : tuple-like, optional
		Defines the limits of the y-axis, it must contain two elements (lower and higer limits).
	clim : list, optional
		Defines the limits of the colour map ranges, it must contain two elements (lower and higer limits).
	clog : bool, optional
		If True, the colour map is changed from linear to logarithmic.
	xinvert : bool, optional
		If True, inverts the x-axis.
	yinvert : bool, optional
		If True, inverts the y-axis.
	cbar_invert : bool, optional
		If True, inverts the direction of the colour bar (not the colour map).
	title : str, optional
		Sets the title of the plot
	xlabel : str, optional
		Sets the label of the x-axis.
	ylabel : str, optional
		Sets the label of the y-axis.
	clabel : str, optional
		Sets the legend for the colour axis.
	lab_loc : int, optional
		Defines the position of the legend
	ax : pyplot.Axes, optional
		Use the given axes to make the plot, defaults to the current axes.
	grid : boolean, optional
		If not given defaults to the value defined in splotch.Params.
	plot_kw : dict, optional
		Explicit dictionary of kwargs to be parsed to matplotlib pcolormesh function.
		Parameters will be overwritten if also given implicitly as a **kwarg.
	**kwargs : pcolormesh properties, optional
		kwargs are used to specify matplotlib specific properties such as `cmap`, `marker`, `norm`, etc.
		A list of available `pcolormesh` properties can be found here:
		https://matplotlib.org/api/_as_gen/matplotlib.pyplot.pcolormesh.html
	
	Returns
	-------
	None
	"""
    from numpy import arange, meshgrid
    from matplotlib.colors import LogNorm
    from matplotlib.pyplot import pcolormesh, colorbar
    from .base_func import axes_handler, plot_finalizer
    if ax is not None:
        old_axes = axes_handler(ax)
    if x is None:
        x = arange(len(im[:, (0)]) + 1)
    if y is None:
        y = arange(len(im[(0), :]) + 1)
    if clog is None:
        from .defaults import Params
        clog = Params.img_caxis_log
    X, Y = meshgrid(x, y)
    plot_par = plot_kw.copy()
    plot_par.update(kwargs)
    if clog:
        pcolormesh(X, Y, im.T, norm=LogNorm(vmin=clim[0], vmax=clim[1],
            clip=True), **plot_par)
    else:
        pcolormesh(X, Y, im.T, vmin=clim[0], vmax=clim[1], **plot_par)
    if clabel is not None:
        cbar = colorbar()
        cbar.set_label(clabel)
        if cbar_invert:
            cbar.ax.invert_yaxis()
    plot_finalizer(False, False, xlim, ylim, title, xlabel, ylabel, xinvert,
        yinvert, grid)
    if ax is not None:
        old_axes = axes_handler(old_axes)
