0

I'm trying to create a line plot of a ~30.000 entries long array using pandas_bokeh in jupyter-notebook but constant values seem to be invisible when zoomet out.

When I further zoom in I can see that the data points are there but somehow dashed.

I tried the options provided on the pandas_bokeh github page: https://github.com/PatrikHlobil/Pandas-Bokeh#lineplot

My current workaround is to use the plot_data_points=True argument with very small square markers.

This is a minimum example to replicate the issue:

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

a = np.empty(2000)
a.fill(7)
test = pd.DataFrame(a, columns=['a'])
test.plot()

I'm using

  • Python 3.9.7
  • Jupyter Notebook 6.4.5
  • BokehJS 2.4.1
mosc9575
  • 5,618
  • 2
  • 9
  • 32
NoMonkey
  • 3
  • 3
  • This looks like there are 1999 lines drawn, a line between each point. I guess this is a bug. – mosc9575 Nov 18 '21 at 09:58
  • I opend a ticket [#117](https://github.com/PatrikHlobil/Pandas-Bokeh/issues/117) on github. Maybe this can be avoided in future. – mosc9575 Nov 19 '21 at 10:24

1 Answers1

0

This is truly a bug which should go to GitHub.

I made a small modification to your exmaple

import pandas as pd
import pandas_bokeh

df = pd.DataFrame({'a':7}, index=pd.RangeIndex(20))
df['x'] = df.index
df.plot_bokeh(kind='line')

And the output it this:

Same parameter set for both lines

As you can see the figure draws different types of lines with the same parameter set for both lines.

As long this is broken, you can use plain bokeh. To create this figure using bokeh, this is the example:

from bokeh.plotting import show, figure, output_notebook
output_notebook()

p = figure(width=600, height=400)
p.line(x='index', y='a', source=test)
show(p)
mosc9575
  • 5,618
  • 2
  • 9
  • 32