'Getting Errors when combining Bar graph with line plot in Sea born [duplicate]

I am trying to combine a bar chart(with hue) and line plot (with hue). I am able to plot them separately. But together, I get some garbage graph.

Code:

import matplotlib
import matplotlib.pyplot as plt
import seaborn as sns

matplotlib.rc_file_defaults()
ax1 = sns.set_style(style=None, rc=None )

fig, ax1 = plt.subplots(figsize=(12,6))


sns.barplot(data = dd, x='time', y='c',hue="p", alpha=0.5)

ax2 = ax1.twinx()
sns.lineplot(x="time", y="a", hue="p", data=dd, marker="o",ax=ax2)

Result Graph

Bar Graph Separate

Line Plot Separate

How do I fix this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source