Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No adaptative xaxis tick label and gridline for X float value #99

Closed
leopoletti opened this issue Apr 7, 2021 · 3 comments
Closed

No adaptative xaxis tick label and gridline for X float value #99

leopoletti opened this issue Apr 7, 2021 · 3 comments

Comments

@leopoletti
Copy link

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

@PatrikHlobil
Copy link
Owner

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

@leopoletti
Copy link
Author

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

@PatrikHlobil
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants