def scatter_plot(data, index_x, index_y, percent=100.0, seed=1, size=50, title=None, outfile=None, wait=True):
    """
    Plots two attributes against each other.

    TODO: click events http://matplotlib.org/examples/event_handling/data_browser.html

    :param data: the dataset
    :type data: Instances
    :param index_x: the 0-based index of the attribute on the x axis
    :type index_x: int
    :param index_y: the 0-based index of the attribute on the y axis
    :type index_y: int
    :param percent: the percentage of the dataset to use for plotting
    :type percent: float
    :param seed: the seed value to use for subsampling
    :type seed: int
    :param size: the size of the circles in point
    :type size: int
    :param title: an optional title
    :type title: str
    :param outfile: the (optional) file to save the generated plot to. The extension determines the file format.
    :type outfile: str
    :param wait: whether to wait for the user to close the plot
    :type wait: bool
    """
    if not plot.matplotlib_available:
        logger.error("Matplotlib is not installed, plotting unavailable!")
        return

    # create subsample
    data = plot.create_subsample(data, percent=percent, seed=seed)

    # collect data
    x = []
    y = []
    if data.class_index == -1:
        c = None
    else:
        c = []
    for i in range(data.num_instances):
        inst = data.get_instance(i)
        x.append(inst.get_value(index_x))
        y.append(inst.get_value(index_y))
        if c is not None:
            c.append(inst.get_value(inst.class_index))

    # plot data
    fig, ax = plt.subplots()
    if c is None:
        ax.scatter(x, y, s=size, alpha=0.5)
    else:
        ax.scatter(x, y, c=c, s=size, alpha=0.5)
    ax.set_xlabel(data.attribute(index_x).name)
    ax.set_ylabel(data.attribute(index_y).name)
    if title is None:
        title = "Attribute scatter plot"
        if percent != 100:
            title += " (%0.1f%%)" % percent
    ax.set_title(title)
    ax.plot(ax.get_xlim(), ax.get_ylim(), ls="--", c="0.3")
    ax.grid(True)
    fig.canvas.set_window_title(data.relationname)
    plt.draw()
    if outfile is not None:
        plt.savefig(outfile)
    if wait:
        plt.show()
Plots two attributes against each other.

    TODO: click events http://matplotlib.org/examples/event_handling/data_browser.html

    :param data: the dataset
    :type data: Instances
    :param index_x: the 0-based index of the attribute on the x axis
    :type index_x: int
    :param index_y: the 0-based index of the attribute on the y axis
    :type index_y: int
    :param percent: the percentage of the dataset to use for plotting
    :type percent: float
    :param seed: the seed value to use for subsampling
    :type seed: int
    :param size: the size of the circles in point
    :type size: int
    :param title: an optional title
    :type title: str
    :param outfile: the (optional) file to save the generated plot to. The extension determines the file format.
    :type outfile: str
    :param wait: whether to wait for the user to close the plot
    :type wait: bool