Skip to content Skip to sidebar Skip to footer

Matplotlib Scatter Plot Different Colors In Legend And Plot

I have a scatter plot of multiple y-values for the same x-value, in matplotlib (python 2.7). There are different colors for all the plotted y-values. See the plot below. Now, here

Solution 1:

In your plot there are different colors for the error bars and the scatter plot points. You can make them the same like this:

c = next(colors) 
ax.errorbar(df2a['x_var_plot'],  df2a[col], color = c, yerr=df2a_err[col], fmt='o')
ax.scatter(df2a['x_var_plot'], df2a[col], color = c, label=col)

enter image description here

Post a Comment for "Matplotlib Scatter Plot Different Colors In Legend And Plot"