def displayXY(dbname, xnames, ynames, case_sql=None, var_sql=None,
              title='', grid=False, xlabel='', ylabel=''):
    """Display an XY plot using Case data from a sqlite DB.

    dbname: str
        Name of the database file.

    xnames: list[str]
        Names of X variables.

    ynames: list[str]
        Names of Y variables.

    case_sql: str (optional)
        SQL syntax that will be placed in the WHERE clause for Case retrieval.

    var_sql: str (optional)
        SQL syntax that will be placed in the WHERE clause for variable retrieval.

    title: str (optional)
        Plot title.

    grid: bool (optional)
        If True, a grid is drawn on the plot.

    xlabel: str (optional)
        X axis label.

    ylabel: str (optional)
        Y axis label.
    """
    try:
        if 'matplotlib' not in sys.modules:
            import matplotlib
            if sys.platform == 'darwin':
                matplotlib.use('MacOSX')
            else:
                try:
                    import wx
                except ImportError:
                    matplotlib.use('TkAgg')
                else:
                    matplotlib.use('WxAgg')

        import matplotlib.pyplot as plt
    except ImportError:
        print 'matplotlib not found'
        return

    fig = plt.figure()
    fig.add_subplot(111)

    for i, line in enumerate(_get_lines(dbname, xnames, ynames, case_sql, var_sql)):
        args = []
        kwargs = {}
        args.append(line[0])
        args.append(line[1])
        kwargs['label'] = '%s' % ynames[i]
        plt.plot(*args, **kwargs)
    if grid:
        plt.grid(True)
    if xlabel:
        plt.xlabel(xlabel)
    if ylabel:
        plt.ylabel(ylabel)
    if title:
        plt.title(title)
    plt.legend()
    plt.show()
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.lib/src/openmdao/lib/casehandlers/dbcase.py/displayXY/original