Skip to content

rasterize with time series data fails for plotly and matplotlib #6089

@buckeye17

Description

@buckeye17

ALL software version info

(this library, plus any other relevant software, e.g. bokeh, python, notebook, OS, browser, etc)

Windows 10
VSCode 1.85.2
Python 3.9.13

bokeh 3.3.4 Interactive plots and applications in the browser from Python
dash 2.14.2 A Python framework for building reactive web-apps. Developed by Plotly.
dash-bootstrap-components 1.5.0 Bootstrap themed components for use in Plotly Dash
dash-core-components 2.0.0 Core component suite for Dash
dash-html-components 2.0.0 Vanilla HTML components for Dash
datashader 0.16.0 Data visualization toolchain based on aggregating into a grid
holoviews 1.18.1 Stop plotting your data - annotate your data and let it visualize itself.
jupyter-bokeh 3.0.7 A Jupyter extension for rendering Bokeh content.
jupyter-client 8.6.0 Jupyter protocol implementation and client libraries
jupyter-core 5.5.1 Jupyter core package. A base package on which Jupyter projects rely.
jupyterlab-widgets 3.0.9 Jupyter interactive widgets for JupyterLab
numpy 1.26.2 Fundamental package for array computing in Python
pandas 2.1.4 Powerful data structures for data analysis, time series, and statistics
plotly 5.18.0 An open-source, interactive data visualization library for Python

Description of expected behavior and the observed behavior

To visualize long time series data with Datashader in Dash web app. Note that in a Jupyter notebook, the visualization works without the rasterize() wrapper. And the Dash web app graph works if the X-axis is changed from datetimes to integers. So it seems that rasterize() does not work with a time series axis sent through to_dash().

Complete, minimal, self-contained example code that reproduces the issue

There is an example here:
https://community.plotly.com/t/dash-holoviews-datashader-datetime-axes-y-u-no-work/54241

Stack traceback and/or browser JavaScript console output

Traceback (most recent call last):
  File "c:\Users\613186\git_projects\Sensor-Analytics-Pipeline\ui\app.py", line 172, in update_graphs
    components = to_dash(app, [scatter], reset_button=True)
  File "C:\Users\613186\git_projects\Sensor-Analytics-Pipeline\.venv\lib\site-packages\holoviews\plotting\plotly\dash.py", line 377, in to_dash
    plot = PlotlyRenderer.get_plot(hvobj)
  File "C:\Users\613186\git_projects\Sensor-Analytics-Pipeline\.venv\lib\site-packages\holoviews\plotting\renderer.py", line 240, in get_plot
    plot.update(init_key)
  File "C:\Users\613186\git_projects\Sensor-Analytics-Pipeline\.venv\lib\site-packages\holoviews\plotting\plot.py", line 955, in update
    return self.initialize_plot()
  File "C:\Users\613186\git_projects\Sensor-Analytics-Pipeline\.venv\lib\site-packages\holoviews\plotting\plotly\element.py", line 130, in initialize_plot
    fig = self.generate_plot(self.keys[-1], ranges, is_geo=is_geo)
  File "C:\Users\613186\git_projects\Sensor-Analytics-Pipeline\.venv\lib\site-packages\holoviews\plotting\plotly\element.py", line 185, in generate_plot
    data = self.get_data(element, ranges, style, is_geo=is_geo)
  File "C:\Users\613186\git_projects\Sensor-Analytics-Pipeline\.venv\lib\site-packages\holoviews\plotting\plotly\raster.py", line 50, in get_data
    x0, y0 = l+dx/2., b+dy/2.
numpy.core._exceptions._UFuncBinaryResolutionError: ufunc 'add' cannot use operands with types dtype('<M8[ns]') and dtype('float64')

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions