Exporting datashader figures

I’m trying to do something which sounds simple, but somehow can’t seem to figure out. I’ve seen the other topic, but the solution doesn’t work for me.

I’m using fig = hd.rasterize(hv.Curve((50M points timeserie)).opts(cmap=cwr) to extract trends within noise with great success. I love the displays resulting out of it.

I need to export a lot of figures in an automated way.

hv.save(fig, …) errors out with weird errors (missing geckodriver; port timeout, etc)

I’ve tried different environments without success.

I’ve tried:
cvs = ds.Canvas(plot_width=900, plot_height=400)
agg_points = cvs.points(df, “x”, “y”)
agg_lines = cvs.line(df, “x”, “y”)

which I’m able to export just fine, but point doesn’t preserve the lines between the points (which I need) and line does not remotely behave like rasterize or datashade (solid block of single color due to noise).

Any alternatives to export the output figure of rasterize or reproduce it?

Many thanks

This is the best result I’ve found so far:

agg = cvs.line(df, “x”, “y”, agg=ds.count(), line_width=0)
img = tf.shade(agg, cmap=cwr, how=“eq_hist”) # or how=“linear”
img.to_pil().save(“out.png”)