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 populations to plot.
    :param theColors: the colors of the populations to plot.
    :param theSizes: the sizes of the markers for each population to plot.
    :param theMarkers: the type of markers 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 theSizes: list
    :type theMarkers: list
    :type options: argparse.Namespace

def plotMDS(data, theOrders, theLabels, theColors, 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 populations to plot.
    :param theColors: the colors of the populations to plot.
    :param theSizes: the sizes of the markers for each population to plot.
    :param theMarkers: the type of markers 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 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()
    ax = fig.add_subplot(111)

    # The plot
    plotObject = []
    labels = []
    for i, index in enumerate(theOrders):
        tmp, = ax.plot(data[0][index], data[1][index], theMarkers[i],
                       color=theColors[i], mec=theColors[i],
                       markersize=theSizes[i])
        plotObject.append(tmp)
        labels.append(theLabels[index])

    # The legend
    prop = mpl.font_manager.FontProperties(size=10)
    leg = ax.legend(plotObject, labels, loc="upper left", numpoints=1,
                    fancybox=True, prop=prop)

    # The title and XY labels
    ax.set_title(options.title)
    ax.set_xlabel(options.xlabel)
    ax.set_ylabel(options.ylabel)

    if options.format == "X11":
        # Show the plot
        plt.show()
    else:
        fileName = options.out + "." + options.format
        try:
            plt.savefig(fileName)
        except IOError:
            msg = "%(fileName)s: can't write file" % locals()
            raise ProgramError(msg)