Pandas-Bokeh icon indicating copy to clipboard operation
Pandas-Bokeh copied to clipboard

line_join option not respected? Jaggy line plots for noisy data

Open Thomasillo opened this issue 4 years ago • 5 comments

Plotting noisy data using pandas_bokeh yields visually incorrect results.

import pandas as pd
import pandas_bokeh
import numpy as np

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

df = pd.DataFrame(np.random.rand(2000))
assert (df.min() > 0).all()
assert (df.max() < 1).all()
df.plot_bokeh(line_join="bevel", ylim=(-0.5,1.5))
Bildschirmfoto 2020-12-08 um 12 54 17

Doing the plot "by hand" does not.

from bokeh.plotting import figure
from bokeh.io import output_notebook, show
p1 = figure(title="bevel",plot_width=450, plot_height=250)
p1.line(df.index, df.iloc[:,0], line_join="bevel")
show(p1)
Bildschirmfoto 2020-12-08 um 12 56 54

Thomasillo avatar Dec 08 '20 11:12 Thomasillo

Hi @Thomasillo ,

this is quite an interesting behaviour. thanks for reporting this issue. I will have a look at it.

Best Patrik

PatrikHlobil avatar Dec 08 '20 12:12 PatrikHlobil

Interestingly, I cannot reproduce your behaviour. image

Which version of Bokeh and Pandas-Bokeh are you using?

I am using image

Best Patrik

PatrikHlobil avatar Dec 08 '20 12:12 PatrikHlobil

Hi Patrik, my versions are

pd.__version__, bokeh.__version__, pandas_bokeh.__version__

('1.1.5', '2.2.3', '0.5.2')

Browser is Safari, but in firefox it's the same.

Thomasillo avatar Dec 08 '20 12:12 Thomasillo

That is really weird. Maybe something MacOS specific?

PatrikHlobil avatar Dec 15 '20 11:12 PatrikHlobil

HI @Thomasillo ,

I could reproduce such problems on iOS when running a Bokeh server.

Seems to be a problem with webkit and Bokeh itself.

I indeed found an old Bokeh issue here (https://github.com/bokeh/bokeh/issues/7951). Maybe try to disable webgl via the option df.plot_bokeh(..., webgl=False).

Best Patrik

PatrikHlobil avatar Jan 12 '21 13:01 PatrikHlobil