Visual artifacts when using holoviews.operation.datashader.datashade relative to datashader directly


There seem to be visual artifacts introduced by holoviews.operation.datashader.datashade for line plots, that are not present when using datashader directly.

I tried this:

import holoviews as hv
import numpy as np
from holoviews.operation.datashader import datashade
from holoviews import opts

N = 10
x = np.linspace(0, 1000, N)
y = np.sin(x / 30)
d = np.stack([x, y], axis=1)

c = hv.Path(d, group='G', label='c1')
opts = hv.opts.RGB(width=1000, height=500)
c = datashade(c, line_width=3.0).opts(opts)

You can see sharp barbs in the lines at regular intervals. It seems like there are a lot of choices and options related to rasterization and aggregation, but before I take that plunge I thought I’d ask here since I’m quite inexperienced.

See the next reply for the direct datashader result.

Any ideas what to do about this, greatly appreciated!

Just wanted to add, I tried the same thing using datashader directly, and there are no artifacts:

import numpy as np
import pandas as pd
import datashader as ds
import datashader.transfer_functions as tf

N = 10
x = np.linspace(0, 1000, N)
y = np.sin(x / 30)
df = pd.DataFrame(dict(x=x,y=y))

cvs = ds.Canvas(x_range=(0, 1000), y_range=(-2, 2), 
      plot_height=500, plot_width=1000)
agg = cvs.line(df, 'x', 'y', agg=ds.any(), line_width=2.0)