@@ -2461,32 +2461,60 @@ def _grouped_plot_by_column(plotf, data, columns=None, by=None,
2461
2461
2462
2462
2463
2463
class BokehSeriesPlotMethods (base .SeriesPlotMethods ):
2464
- """Let's start hacking"""
2465
2464
2466
2465
@property
2467
2466
def engine_name (self ):
2468
2467
return 'bokeh'
2469
2468
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 )
2479
2472
2480
- def line (self , ** kwds ):
2481
- """Line drawn using bokeh
2482
2473
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'
2485
2490
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 ):
2487
2497
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 )
2490
2518
2491
2519
2492
2520
class MPLSeriesPlotMethods (base .SeriesPlotMethods ):
@@ -2913,4 +2941,5 @@ def hexbin(self, x, y, C=None, reduce_C_function=None, gridsize=None,
2913
2941
base .register_engine ("matplotlib" , 'series' , MPLSeriesPlotMethods )
2914
2942
base .register_engine ("matplotlib" , 'frame' , MPLFramePlotMethods )
2915
2943
2916
- base .register_engine ('bokeh' , 'series' , BokehSeriesPlotMethods )
2944
+ base .register_engine ('bokeh' , 'series' , BokehSeriesPlotMethods )
2945
+ base .register_engine ('bokeh' , 'frame' , BokehFramePlotMethods )
0 commit comments