Possibility of a single color overlay

I know it is a stretchy question but for this particular purpose we would need to plot an overlay with the same coloring for each different data source. The example with random data is given in the following Jupyter notebook:


I have tried with the shared_datasource option and all others that seemed connected but I simply cannot get it working. Is there a solution for this?

I am asking because rewrite of the complete data analysis would take a long time and the solution for plotting might be easier.

Thank you very much in advance!

Hello @ksonofre Welcome!
Holoviews sets a lot of common defaults which results in very little code
that has to be written. It thus provides a mechanism to override the defaults with h.opts(). Try hv.help( hv.Scatter) for example.

Here is the example from your notebook:

import numpy as np
import pandas as pd
import holoviews as hv; hv.extension('bokeh', logo=None)
import hvplot.pandas

df = pd.DataFrame(
    np.random.rand(20, 4),
    columns=[f'col_{i}' for i in np.arange(1, 5)],
    index=pd.to_timedelta(np.arange(20) * 1e9),
hv.Overlay([df[col].hvplot.scatter().opts(color='blue')   for col in df.columns])

Hi @ea42gh , thanks very much for the fast answer. Unfortunately, the code is quite tangled so the example looks and is very dumbed down to point to the problem. I know about setting of the color of each line. However, the dfx.hvplot.scatter() is done inside a nested loop inside a function hence color setting needs to be different for each pass. The only thing that is easy to modify is a dictionary of images (imgs) or the NdLayout hence my answer. However, if there is no other solution, maybe I can try to set each line with a specific color for each loop. I see there are iterables for colormap colors: Colormaps — HoloViews v1.14.8 Is this the best solution?