Hi @saulobertolino,
I think as @Marc said really need something to work with here otherwise well I feel like I’m guessing and going in round abouts with my limited knowledge… I’ll give it a go though sorry I’m a bit of a bric-o-brac diy-ist I’m sure with some supplied information you’ll get decent help here. From what you’ve said, I’ve put the following together from couple of sources.
Some y1, y2 random data generation and assign it to ‘AB’ category randomly - I guess I’ve left timeseries in for x just because that’s what I’m normally working with rather than an arbitrary random x value
#adapted from: https://stackoverflow.com/questions/42941310/creating-pandas-dataframe-with-datetime-index-and-random-values-in-column
# https://docs.scipy.org/doc//numpy-1.15.0/reference/generated/numpy.random.choice.html
# https://datashader.org/user_guide/Points.html
# https://datashader.org/getting_started/Interactivity.html
import pandas as pd
import numpy as np
from datetime import datetime, timedelta
date_today = datetime.now()
days = pd.date_range(date_today, date_today + timedelta(730), freq='s')
np.random.seed(seed=1111)
data1 = np.random.randint(1, high=100, size=len(days))
data2 = np.random.randint(181, high=280, size=len(days))
data3 = np.random.choice(['A', 'B'], size=len(days))
df = pd.DataFrame({'datetime':days, 'y1': data1, 'y2':data2, 'cat':data3})
Lets define the cat column as a pandas category
df['cat'] = df['cat'].astype('category')
Ok this is where I went in circles and hope understood what you mean so you’ve a couple of columns and the values of those columns are categorically assigned - I’ve stuck with the AB in this case. I couldn’t find a nice way other than to split the initial data frame into two, I’m sure it will be possible to work from the one but that is my lack of understanding
So lets get cracking and see what I’ve done here, first some more imports, then split the df into two copies and plotted and finally overlaid - the plots are coloured differently to A or B assigned. Note had to sample the data right down so could see the colour difference the data sets used aren’t really suitable to use as a demonstration but maybe will work with your data…
import holoviews as hv
import holoviews.operation.datashader as hd
hd.shade.cmap=["lightblue", "darkblue"]
hv.extension("bokeh", "matplotlib")
import datashader as ds
df1 = df.copy()
df2 = df.copy()
df1.drop(columns=['y2'],inplace=True)
df2.drop(columns=['y1'],inplace=True)
points1 = hv.Points(df1.sample(1000))
points2 = hv.Points(df2.sample(1000))
datashaded = hd.datashade(points1, aggregator=ds.count_cat('cat'))
scatter1 = hd.dynspread(datashaded, threshold=0.1).opts(height=500,width=500)
datashaded2 = hd.datashade(points2, aggregator=ds.count_cat('cat'))
scatter2 = hd.dynspread(datashaded2, threshold=0.1).opts(height=500,width=500)
plot = scatter1 + scatter2
plot
Now for the overlay itself
plot2 = scatter1 * scatter2
plot2.opts(ylabel='overlayed')
Again hope of some help [I’m quietly confident I’m not doing things quite right but seems to function], I didn’t check to see if could change between red and blue but the fact it’s not the standard datashade blue tone I believe should be fairly easy to alter the colours to suit - I haven’t tried any further.
Thanks, Carl.