PatrikHlobil / Pandas-Bokeh

Bokeh Plotting Backend for Pandas and GeoPandas

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No adaptative xaxis tick label and gridline for X float value

leopoletti opened this issue · comments

Hello,

I have a problem with xaxis tick label and associated grid line: there is no automatic adaptation leading to display all tick label when there float number.

Hereunder the code to test it:

import numpy as np
import pandas as pd
pd.set_option('plotting.backend', 'pandas_bokeh')
pd.plotting.output_notebook()

np.random.seed(42)
df = pd.DataFrame({"Google": np.random.randn(1000)+0.2, 
                   "Apple": np.random.randn(1000)+0.17}, 
                   index=np.arange(1000)*0.001)
df = df.cumsum()
df = df + 50
df.plot_bokeh(kind="line")

I get this output:
image
image

Do you have any idea how to handle this?

Python 3.8.8
pandas_bokeh 0.5.4
pandas 1.2.3
jupyterlab 3.0.9
notebook 6.2.0
IPython 7.21.0
jupyter-bokeh 2.0.4

OS windows7

Hi @leopoletti ,

there is an xticks option in pandas-bokeh. just try for example:

df.plot_bokeh(kind="line", xticks=np.arange(10)*0.1)

and you get
image

Best Patrik

Hello Patrik,

Thank for your solution it is an helping work around but basiccaly I would like the xtick label to adapat with thz zoom in or zoom as you could could get using directly bokeh:

from bokeh.plotting import figure, show

p=figure()
p.line(x=df.index,y=df.Google, legend_label="Google", color="blue",line_width=2)
p.line(x=df.index,y=df.Apple, legend_label="Apple",color="orange",line_width=2)

show(p)

image
image

Hi @leopoletti,

thanks again for opening the issue. I think the default behaviour should be as you described it with automatic ajustment of the float xaxis. I just release a new release 0.5.5 that implemented this. Looks like this now:

Peek 2021-04-11 19-45

Hope you enjoy working with Pandas-Bokeh.

Best Patrik