pythonseaborn

Seaborn: Plot scatterplot over lineplot in same plot


I am trying to create one plot with one scatter and multiple lineplots. For the points to be seen well, I need the scatterplot in the front. However changing the order inside my code doesn't solve this. The lineplots always cover the scatterplot. Any ideas?

Please help.

enter image description here


Solution

  • Use the zorder parameter when scatterplotting, e.g.

    sns.scatterplot(x, y, ax=ax, color='orange', zorder=7)
    

    You may need to adjust the zorder value depending on the number of elements in your plot.