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

Constant lines are splited #117

Open
mosc9575 opened this issue Nov 18, 2021 · 4 comments
Open

Constant lines are splited #117

mosc9575 opened this issue Nov 18, 2021 · 4 comments

Comments

@mosc9575
Copy link

mosc9575 commented Nov 18, 2021

Environment
Pandas 1.3.3
Python 3.9.7
pandas_bokeh 0.5.5

Problem
When drawing constant lines in with pandas-bokeh it looks like there are multiple shorter lines instead on large on. When using a zoom tool this looks very odd.

import numpy as np
import pandas as pd
import pandas_bokeh

pandas_bokeh.output_notebook()
pd.set_option("plotting.backend", "pandas_bokeh")

df = pd.DataFrame({'x':7}, index=pd.RangeIndex(20))
df['y'] = df.index.values
df.loc[10:15,'y'] = 10
p = df.plot(kind='line')

bokeh_plot (1)

This problem was first mentioned on SO.

@mosc9575 mosc9575 changed the title Static lines a dra Static lines are spererated Nov 18, 2021
@mosc9575 mosc9575 changed the title Static lines are spererated Constant lines are splited Nov 18, 2021
@PatrikHlobil
Copy link
Owner

hi @mosc9575 ,

thanks for submitting this issue. this is indeed a weird behaviour and I have to look at the code why this happens. When I just plot this via Bokeh, I cannot see this behaviour:

image

@vroger11
Copy link
Contributor

Hello, I was curious about this bug.
So, I investigated a little into it and I found that this behavior is linked to the default parameter given to the creation of a figure: output_backend='webgl'

Hence, to reproduce this problem with "pure" bokeh you can use the following code where all parameters used are the same as in pandas_bokeh.

p = figure(title='', toolbar_location='right', active_scroll='wheel_zoom', plot_width=600, plot_height=400, output_backend='webgl', sizing_mode='fixed', x_axis_location='below', x_axis_label='')
p.line(df.index, df.x, legend_label=" x", color="#1f77b4")
p.line(df.index, df.y, legend_label=" y", color="#ff7f0e")
show(p)

By removing the output_backend='webgl' parameter, the issue is not there anymore.
Maybe pandas_bokeh should not use the webgl backend by default?

@vroger11
Copy link
Contributor

Meanwhile, I added an issue on the bokeh repository: bokeh/bokeh#12058

@mosc9575
Copy link
Author

mosc9575 commented Mar 26, 2022

Meanwhile, I added an issue on the bokeh repository: bokeh/bokeh#12058

@vroger11 Your investigation is gold worth. Thanks a lot.

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

3 participants