Skip to content

Commit ae1d722

Browse files
committed
fixup! Add a placeholder for bokeh engine
1 parent d43a67d commit ae1d722

File tree

1 file changed

+47
-18
lines changed

1 file changed

+47
-18
lines changed

pandas/plotting/_core.py

Lines changed: 47 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2461,32 +2461,60 @@ def _grouped_plot_by_column(plotf, data, columns=None, by=None,
24612461

24622462

24632463
class BokehSeriesPlotMethods(base.SeriesPlotMethods):
2464-
"""Let's start hacking"""
24652464

24662465
@property
24672466
def engine_name(self):
24682467
return 'bokeh'
24692468

2470-
def __call__(self, kind='line', ax=None,
2471-
figsize=None, use_index=True, title=None, grid=None,
2472-
legend=False, style=None, logx=False, logy=False,
2473-
loglog=False, xticks=None, yticks=None,
2474-
xlim=None, ylim=None,
2475-
rot=None, fontsize=None, colormap=None, table=False,
2476-
yerr=None, xerr=None,
2477-
label=None, secondary_y=False, **kwds):
2478-
pass
2469+
def __call__(**kwds):
2470+
import logging
2471+
logging.error(kwds)
24792472

2480-
def line(self, **kwds):
2481-
"""Line drawn using bokeh
24822473

2483-
Args:
2484-
**kwds:
2474+
class BokehFramePlotMethods(base.FramePlotMethods):
2475+
"""
2476+
repro notebook:
2477+
2478+
import pandas as pd
2479+
import numpy as np
2480+
import bokeh
2481+
from bokeh.io import output_notebook, INLINE
2482+
pd.set_option('plotting.engine', 'bokeh')
2483+
df = pd.DataFrame(np.random.rand(5, 3))
2484+
df.plot()
2485+
"""
2486+
2487+
@property
2488+
def engine_name(self):
2489+
return 'bokeh'
24852490

2486-
Returns:
2491+
def __call__(self, x=None, y=None, kind='line', figure=None,
2492+
use_index=True, title=None, grid=None,
2493+
legend=True, style=None,
2494+
fontsize=None, colormap=None,
2495+
yerr=None, xerr=None,
2496+
secondary_y=False, sort_columns=False, **kwds):
24872497

2488-
"""
2489-
return self(kind='line', **kwds)
2498+
from bokeh.plotting import Figure, show
2499+
from bokeh.models import ColumnDataSource, HoverTool
2500+
2501+
df = self._data
2502+
source = ColumnDataSource(df)
2503+
hover_tool = HoverTool(
2504+
tooltips=[
2505+
('index', '$index'),
2506+
('(x,y)', '($x, $y)'),
2507+
]
2508+
)
2509+
plot = Figure(
2510+
width=450,
2511+
height=300,
2512+
logo=None,
2513+
tools=[hover_tool]
2514+
)
2515+
for column in df.columns:
2516+
plot.line(x='index', y=column, source=source);
2517+
return show(plot)
24902518

24912519

24922520
class MPLSeriesPlotMethods(base.SeriesPlotMethods):
@@ -2913,4 +2941,5 @@ def hexbin(self, x, y, C=None, reduce_C_function=None, gridsize=None,
29132941
base.register_engine("matplotlib", 'series', MPLSeriesPlotMethods)
29142942
base.register_engine("matplotlib", 'frame', MPLFramePlotMethods)
29152943

2916-
base.register_engine('bokeh', 'series', BokehSeriesPlotMethods)
2944+
base.register_engine('bokeh', 'series', BokehSeriesPlotMethods)
2945+
base.register_engine('bokeh', 'frame', BokehFramePlotMethods)

0 commit comments

Comments
 (0)