Output within Spyder (Win10 / Anaconda)

Newbie question: I have been trying the Datashader output examples at Interactivity — Datashader 0.13.0 documentation
and they run without error, but I see no graphical output on my Spyder console window, only something like:

Out[30]: 
:DynamicMap   []
   :RGB   [x,y]   (R,G,B,A)

I’m using Anaconda on Windows, versions:

  • Spyder version: 5.1.5 None
  • Python version: 3.8.12 64-bit
  • Qt version: 5.9.7
  • PyQt5 version: 5.9.2
  • Operating System: Windows 10

Maybe graphical output is only supposed to work in a Jupyter Notebook? I can open a Jupyter browser tab from the Anaconda menu of that name, and open or edit a file in that window, but there is no run button or apparent way to execute code.

Note: I did get the expected output plot in a browser tab, using plotly. The following example does work for me.

import numpy as np
import datashader as ds
import pandas as pd
import plotly.express as px
from plotly.offline import plot

data = np.random.randn(10000, 2)
df = pd.DataFrame(data, columns=['x', 'y'])
cvs = ds.Canvas(plot_width=50, plot_height=50)
agg = cvs.points(df, 'x', 'y')
fig = px.imshow(agg)
plot(fig)

Hi @jbeale1,

Yes most of the examples on the website are meant to be run in a Jupyter notebook. Actually, the website itself (as all the other websites of Holiviz) is mostly built out of Jupyter notebooks, you can find them in the examples folder of the Github repository.

To be more accurate, in the link you shared most of the plots are displayed by HoloViews. HoloViews create objects that hold your data and have enough metadata to be able to display themselves as plots in a notebook. But outside of a notebook, you just get the object representation.

In Spyder I believe you could get Matplotlib plots displayed in the Plot pane (there are a few Matplotlib plots at the bottom of the link you shared) or inline in the console, check the Spyder docs and settings.

I can open a Jupyter browser tab from the Anaconda menu of that name, and open or edit a file in that window, but there is no run button or apparent way to execute code.

I’m not sure I understand that, if it’s still a problem for you please share a screenshot or GIF to show us what’s going wrong :upside_down_face: