☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Datashader image not rendering when zoom in bokeh plots

Community Support
Yasir_Azeem
Yasir_Azeem

Hello.

Here is my code:

x_range = (0, len(df))

y_range = (df[‘EuPrice’].min(), df[‘EuPrice’].max())

def create_image(x_range, y_range, w, h):

cvs = ds.Canvas(plot_width=w, plot_height=w//1.2)

agg = cvs.line(df, ‘fakedata’, ‘EuPrice’,ds.count(‘fakedata’))

img = tf.shade(agg)

return img

def base_plot(tools=‘pan,wheel_zoom,box_zoom,resize,reset’):

p = bp.figure(tools=tools, plot_width=600, plot_height=300,

x_range=x_range, y_range=y_range, outline_line_color=None,

min_border=0, min_border_left=0, min_border_right=0,

min_border_top=0, min_border_bottom=0)

p.xgrid.grid_line_color = None

p.ygrid.grid_line_color = None

return p

p = base_plot()

InteractiveImage(p, create_image)

Problem is that it loads the plot from datashader into bokeh plot interface. But when I zoom the image, only axis values change, but the plot image returns to the same point when I try to zoom the data. Zooms in a bit but then back to full stack of data view.

[Needless to say I am quite new in learning these libraries]

⌁   Link to post
James_A_Bednar1
James_A_Bednar1

Hi Yasir,

Welcome to datashader!

In your code, the data range interactively chosen in the Bokeh plot is passed in to your create_image callback as x_range and y_range, but then you aren’t actually using those values, and so your data range will never be updated. You need to pass those ranges into datashader’s Canvas operation if you want the ranges to be respected:

cvs = ds.Canvas(plot_width=w, plot_height=w//1.2, x_range=x_range, y_range=y_range)

···

On Fri, Jan 13, 2017 at 3:19 PM, Yasir Azeem yasirazeem77@gmail.com wrote:

Hello.

Here is my code:

x_range = (0, len(df))

y_range = (df[‘EuPrice’].min(), df[‘EuPrice’].max())

def create_image(x_range, y_range, w, h):

cvs = ds.Canvas(plot_width=w, plot_height=w//1.2)

agg = cvs.line(df, ‘fakedata’, ‘EuPrice’,ds.count(‘fakedata’))

img = tf.shade(agg)

return img

def base_plot(tools=‘pan,wheel_zoom,box_zoom,resize,reset’):

p = bp.figure(tools=tools, plot_width=600, plot_height=300,

x_range=x_range, y_range=y_range, outline_line_color=None,

min_border=0, min_border_left=0, min_border_right=0,

min_border_top=0, min_border_bottom=0)

p.xgrid.grid_line_color = None

p.ygrid.grid_line_color = None

return p

p = base_plot()

InteractiveImage(p, create_image)

Problem is that it loads the plot from datashader into bokeh plot interface. But when I zoom the image, only axis values change, but the plot image returns to the same point when I try to zoom the data. Zooms in a bit but then back to full stack of data view.

[Needless to say I am quite new in learning these libraries]

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/0253d216-e185-43de-afc0-d13e7694d241%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Jim

⌁   Link to post
Yasir_Azeem
Yasir_Azeem

Thank you Jim! I found my mistake.

Can you please suggest me how do I use this jupyter notebook to use this plot on my website? Any example for that?

···

On Saturday, January 14, 2017 at 3:15:04 AM UTC+5, James A. Bednar wrote:

Hi Yasir,

Welcome to datashader!

In your code, the data range interactively chosen in the Bokeh plot is passed in to your create_image callback as x_range and y_range, but then you aren’t actually using those values, and so your data range will never be updated. You need to pass those ranges into datashader’s Canvas operation if you want the ranges to be respected:

cvs = ds.Canvas(plot_width=w, plot_height=w//1.2, x_range=x_range, y_range=y_range)

Jim

On Fri, Jan 13, 2017 at 3:19 PM, Yasir Azeem yasira...@gmail.com wrote:

Hello.

Here is my code:

x_range = (0, len(df))

y_range = (df[‘EuPrice’].min(), df[‘EuPrice’].max())

def create_image(x_range, y_range, w, h):

cvs = ds.Canvas(plot_width=w, plot_height=w//1.2)

agg = cvs.line(df, ‘fakedata’, ‘EuPrice’,ds.count(‘fakedata’))

img = tf.shade(agg)

return img

def base_plot(tools=‘pan,wheel_zoom,box_zoom,resize,reset’):

p = bp.figure(tools=tools, plot_width=600, plot_height=300,

x_range=x_range, y_range=y_range, outline_line_color=None,

min_border=0, min_border_left=0, min_border_right=0,

min_border_top=0, min_border_bottom=0)

p.xgrid.grid_line_color = None

p.ygrid.grid_line_color = None

return p

p = base_plot()

InteractiveImage(p, create_image)

Problem is that it loads the plot from datashader into bokeh plot interface. But when I zoom the image, only axis values change, but the plot image returns to the same point when I try to zoom the data. Zooms in a bit but then back to full stack of data view.

[Needless to say I am quite new in learning these libraries]

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+un...@continuum.io.

To post to this group, send email to bo...@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/0253d216-e185-43de-afc0-d13e7694d241%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

⌁   Link to post
James_A_Bednar1
James_A_Bednar1

To use a datashader plot, you'll need a running server. E.g. this notebook:

https://anaconda.org/jbednar/stock_dashboard/notebook

has been set up to work with the Jupyter Dashboard server; follow the
instructions at GitHub - jupyter/dashboards: [RETIRED] See Voilà as a supported replacement to obtain and launch
such a server, and then supply this notebook.

Jim

···

On Sat, Jan 14, 2017 at 2:09 AM, Yasir Azeem <yasirazeem77@gmail.com> wrote:

Thank you Jim! I found my mistake.

Can you please suggest me how do I use this jupyter notebook to use this
plot on my website? Any example for that?

⌁   Link to post
James_A_Bednar1
James_A_Bednar1

Unfortunately, InteractiveImage only works in Jupyter Notebook. To run
plots like this on Bokeh Server, you can adapt the code from
examples/dashboard/dashboard.py.

Jim

···

On Sun, Jan 15, 2017 at 6:24 AM, Yasir Azeem <yasirazeem77@gmail.com> wrote:

Can I run this on Bokeh Server?

⌁   Link to post
Yasir_Azeem
Yasir_Azeem

Thank you, I’ll look into it.

Can you please tell me how do I use “2016-11-01 21:30:00” format to plot for a time series… Error comes out x must be real…

Also can we use hovertools with datashader?

···

On Sunday, January 15, 2017 at 8:12:45 PM UTC+5, James A. Bednar wrote:

On Sun, Jan 15, 2017 at 6:24 AM, Yasir Azeem yasira...@gmail.com wrote:

Can I run this on Bokeh Server?

Unfortunately, InteractiveImage only works in Jupyter Notebook. To run plots like this on Bokeh Server, you can adapt the code from examples/dashboard/dashboard.py.

Jim

⌁   Link to post
James_A_Bednar1
James_A_Bednar1

Thank you, I'll look into it.

Can you please tell me how do I use "2016-11-01 21:30:00" format to plot
for a time series... Error comes out x must be real...

Datashader currently only supports numeric indexes. However, you can
convert your dates to int64 and then use a custom formatter with
HoloViews/Bokeh to plot it as a string, as shown in Philipp Rudiger's
"Datetime Timeseries" example at the end of:

https://anaconda.org/philippjfr/holoviews_datashader

Also can we use hovertools with datashader?

There is a hover_layer notebook in the datashader/examples/ directory
showing how to use hover, and the examples/dashboard script also supports
hovering, but those examples may be out of date with the latest versions of
Bokeh. Definitely an area we need to work on making easier and better
supported.

Jim

···

On Wed, Jan 18, 2017 at 5:22 AM, Yasir Azeem <yasirazeem77@gmail.com> wrote:

⌁   Link to post

End of archived discussion · Replies are disabled