The Problem
I have 2 dataframes which I combine and then melt with pandas. I need to multi-plot them (as below) and the code needs to be scalable. They consist of 2 variables which form the 'key' column below ('x' and 'y' here), across multiple 'stations' (just 2 here, but needs to be scalable). I've used relplot()
to be able to multi-plot the two variables on each graph, and different stations on separate graphs.
Is there any way to maintain this format but introduce a 2nd y axis to each plot? 'x' and 'y' need to be on different scales in my actual data. I've seen
CodePudding user response:
Not what you asked for, but you could make a grid of relplots with different y-axes without changing your df shape
fg = sns.relplot(
data=df,
x = "index",
y = "station_value",
kind = "line",
col = "key",
row = "station",
facet_kws={'sharey': False, 'sharex': True},
)