Change marker of Scatter Plot

Hi all,

I would like to change the marker of a scatter plot using hvplot.scatter (setting datashader=True) from a point to a vertical line. But unfortunately I (a) couldn’t find the option of a vertical line as a marker and (b) the marker parameter in the function is ignored entirely, also if I set it to ‘x’ for example, the points always stay tiny points and get smaller and smaller by zooming in.

This is the code I used:
df.hvplot.scatter(x=“time_points”, y=“units”, marker=‘x’, datashade=True)
where df is a dataframe with the two columns ‘time_points’ and ‘units’.

Many thanks,

The hv.Spikes element was created with neural spike trains in mind, and recent versions of Datashader and HoloViews support datashading Spikes. It should be as simple as from holoviews.operation.datashader import rasterize ; rasterize(hv.Spikes(...).

You can see a full list of bokeh markers here. You probably want 'dash' and then set a fixed 'angle' to make it vertical.

Thanks a lot for your reply!

The ‘dash’ option works fine if I don’t use datashade:

scatter = hv.Scatter(data)
scatter.opts(color=‘b’, marker=‘dash’, size=10, line_width=0.2, angle=90, width=1200, height=600)

The result is exactly what I would like to get, but the interaction (moving the plot and zooming in) is pretty slow. Do you have any suggestion on how to improve the performance?

On the other hand, if I plot from a dataframe, using hvplot and datashade:

df.hvplot.scatter(x=“spike_time”, y=“unit_id”, marker=‘dash’, angle=90, datashade=True, width=1200, height=600)

the parameters ‘marker’ and ‘angle’ are ignored and I always get the same plot.

Many thanks!

Datashading is an entirely different approach to rendering and will never support the same flexibility as regular bokeh plots support. It may be possible to eventually implement markers in datashader but really that’s not what it’s made for. So I really don’t have a good suggestion for you as of right now.