PatrikHlobil / Pandas-Bokeh

Bokeh Plotting Backend for Pandas and GeoPandas

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Control Level of Detail

bryceschober opened this issue · comments

How could I control the figure's level of detail? I tried to head-bang my way through AttributeError exceptions, but I didn't find a way to set the lod_threshold and related properties...

Hi @bryceschober ,

there is currently no direct way to do so when calling pandas_bokeh. However, you can just use the Bokeh figure that is returned by Pandas-Bokeh to set the attribute, e.g.:

import pandas as pd
import pandas_bokeh

pandas_bokeh.output_notebook()
import numpy as np

np.random.seed(42)
df = pd.DataFrame(
    {"Google": np.random.randn(1000) + 0.2, "Apple": np.random.randn(1000) + 0.17},
    index=pd.date_range("1/1/2000", periods=1000),
)
df = df.cumsum()
df = df + 50
f = df.plot_bokeh(kind="line", show_figure=False)
f.lod_threshold= 20
pandas_bokeh.show(f)

Hope this helps you,

Best Patrik

I hope that the issue is solved and will close it. If you disagree feel free to contact me.

Best Patrik