Matplotlib.axes.Axes.set_fc() in Python
Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. The Axes Class contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. And the instances of Axes supports callbacks through a callbacks attribute.
matplotlib.axes.Axes.set_fc() Function
The Axes.set_fc() function in axes module of matplotlib library is used to set the facecolor of the Axes.
Syntax: Axes.set_fc(self, color)
Parameters: This method accept only one parameters.
color: This parameter accepts the color for the facecolor of the axes.Returns:This method does not returns any value.
Below examples illustrate the matplotlib.axes.Axes.set_fc() function in matplotlib.axes:
Example 1:
# Implementation of matplotlib function import matplotlib.pyplot as plt import numpy as np fig, ax = plt.subplots() ax.set_fc( '# B6ABF0' ) ax.set_xlabel( 'x-axis' ) ax.set_ylabel( 'y-axis' ) ax.plot([ 1 , 2 , 3 ], color = "black" ) ax.set_title('matplotlib.axes.Axes.set_fc()\ Example\n ', fontsize = 12, fontweight =' bold') plt.show() |
Output:
Example 2:
# Implementation of matplotlib function import numpy as np import matplotlib.pyplot as plt t = np.linspace( 0.0 , 2.0 , 201 ) s = np.sin( 2 * np.pi * t) fig, ax = plt.subplots() ax.set_fc( '# 339E17' ) ax.set_xlabel( 'x-axis' ) ax.set_ylabel( 'y-axis' ) ax.plot(t, s, ) ax.set_title('matplotlib.axes.Axes.set_fc()\ Example\n ', fontsize = 12, fontweight =' bold') plt.show() |
Output: