Last answered:

20 Jun 2024

Posted on:

05 Jun 2024

1

String of single character colors deprecated

Just wanted to let the community know that using a string of single characters for colors will be removed soon (Using color = "rgbwymc"):


MatplotlibDeprecationWarning: Using a string of single character colors as a color sequence is deprecated since 3.2 and will be removed two minor releases later. Use an explicit list instead.
  plt.bar(x = df_used_cars["Brand"], height = df_used_cars["Cars Listings"], color = "rgbwymc")

1 answers ( 0 marked as helpful)
Instructor
Posted on:

20 Jun 2024

0

Hi Samantha, 

thanks for reaching out! It has been deprecated unfortunately in the newer versions of the library. Instead you can use the full names of colors in the list, like so:

# Define colors explicitly as a list
colors = ['red', 'green', 'blue', 'white', 'yellow', 'magenta', 'cyan']

# Plotting
plt.bar(x=df_used_cars["Brand"], height=df_used_cars["Cars Listings"], color=colors)
plt.show()

Best, 

365 Eli

Submit an answer