Я сейчас реализовал это с помощью plotly.
import seaborn as sns
import plotly.graph_objects as go
df=sns.load_dataset("mpg")
show=['mpg','displacement','acceleration']
mcolors=[
'#1f77b4', # muted blue
'#ff7f0e', # safety orange
'#2ca02c', # cooked asparagus green
'#d62728', # brick red
'#9467bd', # muted purple
'#8c564b', # chestnut brown
'#e377c2', # raspberry yogurt pink
'#7f7f7f', # middle gray
'#bcbd22', # curry yellow-green
'#17becf' # blue-teal
];
fig = go.Figure()
m=0
for k in df.model_year.unique():
fig.add_trace(go.Scatter(
x = df.loc[df.model_year == k]['weight'],
y = df.loc[df.model_year == k][show[0]],
name = str(k),
mode = 'markers',
marker_symbol=m,
marker_line_width=0,
marker_size=6,
marker_color=mcolors[0],
))
m+=1
layout = {'xaxis':dict(
domain=[0,0.7]
),
'yaxis':dict(
title=show[0],
titlefont=dict(
color=mcolors[0]
),
tickfont=dict(
color=mcolors[0]
),
showgrid=False
)}
n=2
for i in show[1::]:
m=0
for k in df.model_year.unique():
fig.add_trace(go.Scatter(
x = df.loc[df.model_year == k]['weight'],
y = df.loc[df.model_year == k][i],
name = str(k),
yaxis ='y'+str(n),
mode = 'markers',
marker_symbol=m,
marker_line_width=0,
marker_size=6,
marker_color=mcolors[n],
showlegend = False
))
m+=1
layout['yaxis'+str(n)] = dict(
title=i,
titlefont=dict(
color=mcolors[n]
),
tickfont=dict(
color=mcolors[n]
),
anchor="free",
overlaying="y",
side="right",
position=(n)*0.08+0.55,
showgrid=False,
)
n+=1
fig.update_layout(**layout)
fig.show()