0

Good day. I am trying to plot timeseries with large data 2 billions of points and embed this plot into PyQt5. The Holoviews manual has the whole section on working with large data Working with large data using datashader. I am using the timeseries example from this chapter but when I run it the plot does not show. I tried python from VS Code and run python from Jupyter notebook. I am missing something...

import datashader as ds
import numpy as np
import holoviews as hv
import pandas as pd

from holoviews import opts
from holoviews.operation.datashader import datashade, shade, dynspread, spread, rasterize
from holoviews.operation import decimate

hv.extension('bokeh','matplotlib')

def time_series(T = 1, N = 100, mu = 0.1, sigma = 0.1, S0 = 20):  
    """Parameterized noisy time series"""
    dt = float(T)/N
    t = np.linspace(0, T, N)
    W = np.random.standard_normal(size = N) 
    W = np.cumsum(W)*np.sqrt(dt) # standard brownian motion
    X = (mu-0.5*sigma**2)*t + sigma*W 
    S = S0*np.exp(X) # geometric brownian motion
    return S

points = [(0.1*i, np.sin(0.1*i)) for i in range(100)]
hv.Curve(points)

hv.HoloMap({i: hv.Curve([1, 2, 3-i], group='Group', label='Label') for i in range(3)}, 'Value')

dates = pd.date_range(start="2014-01-01", end="2016-01-01", freq='1D') # or '1min'
curve = hv.Curve((dates, time_series(N=len(dates), sigma = 1)))
rasterize(curve, width=800).opts(width=800, cmap=['blue'])

1 Answers1

0

Works fine for me in Jupyter Notebook: enter image description here

You shouldn't expect it to work in Qt unless you can embed a web browser or if you export a static (non-zoomable) version.

James A. Bednar
  • 3,195
  • 1
  • 9
  • 13
  • Thanks for help! I tried to run in just in the studio and also from the Jupyter Notebook. Could not see the plot in the Jupyter notebook either. Yes, eventually, i will try to embed into PyQt5 using the QtWebEngineWidgets widget. I will try Jupyter on another machine. – Ivan Timofeev Dec 15 '20 at 18:48
  • If you can make a reproducible example (listing all the versions involved) at https://github.com/holoviz/holoviews/issues, then we could investigate why you're having this problem... – James A. Bednar Dec 16 '20 at 19:16