# Path: lantern/utils.py
# def in_ipynb():
#     ip = get_ipython()
#     if ip:
#         cfg = ip.config
#         if cfg.get('IPKernelApp', False):
#             return True
#         return False
#     return False
# 
# Path: lantern/plotting/plotobj.py
# class BasePlot(with_metaclass(ABCMeta)):
#     def __init__(self, backend):
#         pass
# 
#     @abstractmethod
#     def show(self, title='', xlabel='', ylabel='', xaxis=True, yaxis=True, xticks=True, yticks=True, legend=True, grid=True, **kwargs):
#         pass
# 
#     @abstractmethod
#     def area(self, data, color=None, y_axis='left', stacked=False, **kwargs):
#         pass
# 
#     @abstractmethod
#     def bar(self, data, color=None, y_axis='left', stacked=False, **kwargs):
#         pass
# 
#     @abstractmethod
#     def hist(self, data, color=None, y_axis='left', stacked=False, **kwargs):
#         pass
# 
#     @abstractmethod
#     def hline(self, y, color=None, **kwargs):
#         pass
# 
#     @abstractmethod
#     def hspan(self, yhigh, ylow, color=None, **kwargs):
#         pass
# 
#     @abstractmethod
#     def line(self, data, color=None, y_axis='left', **kwargs):
#         pass
# 
#     @abstractmethod
#     def scatter(self, data, color=None, x=None, y=None, y_axis='left', **kwargs):
#         pass
# 
#     @abstractmethod
#     def step(self, data, color=None, y_axis='left', **kwargs):
#         pass
# 
#     @abstractmethod
#     def vline(self, x, color=None, **kwargs):
#         pass
# 
#     @abstractmethod
#     def vspan(self, xhigh, xlow, color=None, **kwargs):
#         pass
# 
# Path: lantern/plotting/plotutils.py
# def get_color(i, col, color):
#     if isinstance(color, list):
#         c = (color[i:i + 1] or [_r()])[0]
#     elif isinstance(color, dict):
#         c = color.get(col, _r())
#     elif isinstance(color, str) and color:
#         c = color
#     else:
#         c = _r()
#     return c


import copy
import pandas as pd
from bokeh.plotting import figure, show, output_notebook
from bokeh.models import Legend, Span
from ..utils import in_ipynb
from .plotobj import BasePlot
from .plotutils import get_color
        else:
            self.figure.legend.location = None

        if not grid:
            self.figure.xgrid.grid_line_color = None
            self.figure.ygrid.grid_line_color = None

        # FIXME
        if not yaxis:
            for ax in self.figure.yaxis:
                ax.axis_line_color = 'white'
        if not xaxis:
            for ax in self.figure.xaxis:
                ax.axis_line_color = 'white'

        # Turn off labels:
        # self.figure.xaxis.major_label_text_font_size = '0pt'

        show(self.figure)
        return self.figure

    def area(self, data, color=None, y_axis='left', stacked=False, **kwargs):
        data2 = data.append(data.iloc[-1] * 0)
        data2 = data2.append(data2.iloc[0] * 0)
        data2 = data2.sort_index()
        data2 = data2.sort_index()
        x, y = copy.deepcopy(data2.iloc[0]), copy.deepcopy(data2.iloc[1])
        data2.iloc[0], data2.iloc[1] = y, x

        for i, col in enumerate(data):

# Path: lantern/utils.py
# def in_ipynb():
#     ip = get_ipython()
#     if ip:
#         cfg = ip.config
#         if cfg.get('IPKernelApp', False):
#             return True
#         return False
#     return False
# 
# Path: lantern/plotting/plotobj.py
# class BasePlot(with_metaclass(ABCMeta)):
#     def __init__(self, backend):
#         pass
# 
#     @abstractmethod
#     def show(self, title='', xlabel='', ylabel='', xaxis=True, yaxis=True, xticks=True, yticks=True, legend=True, grid=True, **kwargs):
#         pass
# 
#     @abstractmethod
#     def area(self, data, color=None, y_axis='left', stacked=False, **kwargs):
#         pass
# 
#     @abstractmethod
#     def bar(self, data, color=None, y_axis='left', stacked=False, **kwargs):
#         pass
# 
#     @abstractmethod
#     def hist(self, data, color=None, y_axis='left', stacked=False, **kwargs):
#         pass
# 
#     @abstractmethod
#     def hline(self, y, color=None, **kwargs):
#         pass
# 
#     @abstractmethod
#     def hspan(self, yhigh, ylow, color=None, **kwargs):
#         pass
# 
#     @abstractmethod
#     def line(self, data, color=None, y_axis='left', **kwargs):
#         pass
# 
#     @abstractmethod
#     def scatter(self, data, color=None, x=None, y=None, y_axis='left', **kwargs):
#         pass
# 
#     @abstractmethod
#     def step(self, data, color=None, y_axis='left', **kwargs):
#         pass
# 
#     @abstractmethod
#     def vline(self, x, color=None, **kwargs):
#         pass
# 
#     @abstractmethod
#     def vspan(self, xhigh, xlow, color=None, **kwargs):
#         pass
# 
# Path: lantern/plotting/plotutils.py
# def get_color(i, col, color):
#     if isinstance(color, list):
#         c = (color[i:i + 1] or [_r()])[0]
#     elif isinstance(color, dict):
#         c = color.get(col, _r())
#     elif isinstance(color, str) and color:
#         c = color
#     else:
#         c = _r()
#     return c


# Path: lantern/plotting/plot_bokeh.py
import copy
import pandas as pd
from bokeh.plotting import figure, show, output_notebook
from bokeh.models import Legend, Span
from ..utils import in_ipynb
from .plotobj import BasePlot
from .plotutils import get_color

        else:
            self.figure.legend.location = None

        if not grid:
            self.figure.xgrid.grid_line_color = None
            self.figure.ygrid.grid_line_color = None

        # FIXME
        if not yaxis:
            for ax in self.figure.yaxis:
                ax.axis_line_color = 'white'
        if not xaxis:
            for ax in self.figure.xaxis:
                ax.axis_line_color = 'white'

        # Turn off labels:
        # self.figure.xaxis.major_label_text_font_size = '0pt'

        show(self.figure)
        return self.figure

    def area(self, data, color=None, y_axis='left', stacked=False, **kwargs):
        data2 = data.append(data.iloc[-1] * 0)
        data2 = data2.append(data2.iloc[0] * 0)
        data2 = data2.sort_index()
        data2 = data2.sort_index()
        x, y = copy.deepcopy(data2.iloc[0]), copy.deepcopy(data2.iloc[1])
        data2.iloc[0], data2.iloc[1] = y, x

        for i, col in enumerate(data):

            c = get_color(i, col, color)