Skip to content
Related Articles

Related Articles

Matplotlib.pyplot.colors() in Python
  • Last Updated : 03 May, 2020
GeeksforGeeks - Summer Carnival Banner

In Python we can plot graphs for visualization using Matplotlib library. For integrating plots into applications, Matplotlib provides an API. Matplotlib has a module named pyplot which provides a MATLAB-like interface.


This function is used to specify the color. It is do-nothing function.


We can use this function for various data visualizations and obtain insights from them.

Examples 1:

import matplotlib.pyplot as plt
# Define the Color
color = 'green'
plt.plot([1, 2, 3, 4], color = color)



Example 2:

import matplotlib.pyplot as plt
x = [1, 2, 3, 4]
y= [1, 4, 9, 16]
plt.plot(x, y, marker = 'o', markerfacecolor = 'r')



Here, marker=’o’ represents circle while markerfacecolor is used for specifying color of the point marker.

Note: This function has been deprecated since version 2.1.

Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :