Plot the MDS data.

    :param data: the data to plot (MDS values).
    :param theOrders: the order of the populations to plot.
    :param theLabels: the names of the populations to plot.
    :param theColors: the colors of the populations to plot.
    :param theAlphas: the alpha value for the populations to plot.
    :param theSizes: the sizes of the markers for each population to plot.
    :param theMarkers: the type of marker for each population to plot.
    :param options: the options.

    :type data: list of numpy.array
    :type theOrders: list
    :type theLabels: list
    :type theColors: list
    :type theAlphas: list
    :type theSizes: list
    :type theMarkers: list
    :type options: argparse.Namespace

def plotMDS(data, theOrders, theLabels, theColors, theAlphas, theSizes,
            theMarkers, options):
    """Plot the MDS data.

    :param data: the data to plot (MDS values).
    :param theOrders: the order of the populations to plot.
    :param theLabels: the names of the populations to plot.
    :param theColors: the colors of the populations to plot.
    :param theAlphas: the alpha value for the populations to plot.
    :param theSizes: the sizes of the markers for each population to plot.
    :param theMarkers: the type of marker for each population to plot.
    :param options: the options.

    :type data: list of numpy.array
    :type theOrders: list
    :type theLabels: list
    :type theColors: list
    :type theAlphas: list
    :type theSizes: list
    :type theMarkers: list
    :type options: argparse.Namespace

    """
    # Do the import
    import matplotlib as mpl
    if options.format != "X11" and mpl.get_backend() != "agg":
        mpl.use("Agg")
    import matplotlib.pyplot as plt
    if options.format != "X11":
        plt.ioff()

    fig = plt.figure()
    try:
        fig.subplots_adjust(right=options.adjust_right,
                            left=options.adjust_left,
                            bottom=options.adjust_bottom,
                            top=options.adjust_top)
    except ValueError as e:
        raise ProgramError(e)
    ax = fig.add_subplot(111)

    # Setting the axis
    ax.xaxis.set_ticks_position("bottom")
    ax.yaxis.set_ticks_position("left")
    ax.spines["top"].set_visible(False)
    ax.spines["right"].set_visible(False)
    ax.spines["bottom"].set_position(("outward", 9))
    ax.spines["left"].set_position(("outward", 9))

    # The plot
    plotObject = []
    labels = []
    for i, index in enumerate(theOrders):
        try:
            tmp, = ax.plot(data[0][i], data[1][i], theMarkers[i],
                           color=theColors[i], mec=theColors[i],
                           markersize=theSizes[i], alpha=theAlphas[i])
        except ValueError as e:
            msg = "Problem with markers: %(e)s" % locals()
            raise ProgramError(msg)
        plotObject.append(tmp)
        labels.append(index)

    # The legend
    prop = mpl.font_manager.FontProperties(size=options.legend_size)
    leg = ax.legend(plotObject, labels, loc=options.legend_position,
                    numpoints=1, fancybox=True, prop=prop,
                    ncol=options.legend_ncol)
    leg.get_frame().set_alpha(0.5)

    # The title and XY labels
    ax.set_title(options.title, fontsize=options.title_fontsize, weight="bold")
    ax.set_xlabel(options.xlabel, fontsize=options.label_fontsize)
    ax.set_ylabel(options.ylabel, fontsize=options.label_fontsize)

    # Changing the size of the tick labels
    for tick in ax.yaxis.get_major_ticks() + ax.xaxis.get_major_ticks():
        tick.label.set_fontsize(options.axis_fontsize)

    if options.format == "X11":
        # Show the plot
        plt.show()
    else:
        fileName = options.out + "." + options.format
        try:
            plt.savefig(fileName, dpi=300)
        except IOError:
            msg = "%(fileName)s: can't write file" % locals()
            raise ProgramError(msg)
        except ValueError as e:
            colorError = False
            for errorMsg in str(e).split("\n"):
                if errorMsg.startswith("to_rgb"):
                    colorError = True
            if colorError:
                msg = "problem with the population colors"
                raise ProgramError(msg)
            else:
                print str(e)