@@ -2458,6 +2458,65 @@ def _grouped_plot_by_column(plotf, data, columns=None, by=None,
2458
2458
return result
2459
2459
2460
2460
2461
+ class BokehSeriesPlotMethods (base .SeriesPlotMethods ):
2462
+
2463
+ @property
2464
+ def engine_name (self ):
2465
+ return 'bokeh'
2466
+
2467
+ def __call__ (** kwds ):
2468
+ import logging
2469
+ logging .error (kwds )
2470
+
2471
+
2472
+ class BokehFramePlotMethods (base .FramePlotMethods ):
2473
+ """
2474
+ repro notebook:
2475
+
2476
+ import pandas as pd
2477
+ import numpy as np
2478
+ import bokeh
2479
+ from bokeh.io import output_notebook, INLINE
2480
+
2481
+ output_notebook(hide_banner=True)
2482
+ pd.set_option('plotting.engine', 'bokeh')
2483
+ df = pd.DataFrame(np.random.rand(5, 3), columns='foo bar baz'.split())
2484
+ df.plot()
2485
+ """
2486
+
2487
+ @property
2488
+ def engine_name (self ):
2489
+ return 'bokeh'
2490
+
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 ):
2497
+
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 )
2518
+
2519
+
2461
2520
class MPLSeriesPlotMethods (base .SeriesPlotMethods ):
2462
2521
"""Series plotting accessor and method
2463
2522
@@ -2845,3 +2904,6 @@ def hexbin(self, x, y, C=None, reduce_C_function=None, gridsize=None,
2845
2904
2846
2905
base .register_engine ("matplotlib" , 'series' , MPLSeriesPlotMethods )
2847
2906
base .register_engine ("matplotlib" , 'frame' , MPLFramePlotMethods )
2907
+
2908
+ base .register_engine ('bokeh' , 'series' , BokehSeriesPlotMethods )
2909
+ base .register_engine ('bokeh' , 'frame' , BokehFramePlotMethods )
0 commit comments