Scatter plot color changes

How can I have my scatter plot points be different colors after adding error bars?

Current behavior:
I just added error bars to my scatter plot, but it changed the colors I had already established for my points, making them all a single color.

Desired behavior
I want my points to be of different colors with the error bars.

Repl link:

code snippet

Hello @IbanaDelgado3 Welcome to the forums!

Try to bring the error bars before the scatter plot, change the parameter of ‘fmt’ to ‘none’ and use ecolor instead of color.

plt.errorbar(wolfcampN, wolfcampC, xerr=None, yerr=None, fmt='none', ecolor="k", label="Wolfcamp")
plt.errorbar(duvernayN, duvernayC, xerr=duverx, yerr=duvery, fmt='none', ecolor="k", label="Duvernay")
plt.errorbar(woodfordN, woodfordC, xerr=woodx, yerr=woody, fmt='none', ecolor="k", label="Woodford")

plt.scatter(wolfcampN, wolfcampC, s=130, c="m")
plt.scatter(duvernayN, duvernayC, s=130, c="c")
plt.scatter(woodfordN, woodfordC, s=130, c="g")

And this is the result:

1 Like