Last answered:

27 Feb 2023

Posted on:

25 Feb 2023


regarding Colors


I am getting an eorror while plotting different colors ("rgbwymc") 

plt.figure(figsize=(9,6))["Brand"], height=df_cars["Cars Listings"],color ="rgbwymc")
plt.xticks(rotation = 45)

ValueError: Using a string of single character colors as a color sequence is not supported. The colors can be passed as an explicit list instead.

Kindly lookin to that and revert to me.




1 answers ( 0 marked as helpful)
Posted on:

27 Feb 2023


Hi Packiarajan, 

thanks for reaching out! It seems that the functionality of using a single string as a color has been deprecated in some versions of matplotlib and is no longer supported, that's why you're getting the error. If you'd like to have individual colors for each bar, you can do the following:
1. Have a list of all the colors, using their full names
2. Pass that list for the color argument
Here is some example code:

colors = ["red","green","blue","white","yellow","magenta","cyan"] = df_used_cars["Brand"], #specify the x axis
        height = df_used_cars["Cars Listings"], #specify the y axis
        color = colors)

Let me know if this version works for you or if you have any further questions!

365 Eli

Submit an answer