Matplotlib.pyplot.sca() in Python Last Updated : 03 May, 2020 Comments Improve Suggest changes Like Article Like Report Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. There are various plots which can be used in Pyplot are Line Plot, Contour, Histogram, Scatter, 3D Plot, etc. matplotlib.pyplot.sca() method The sca() method pyplot module of matplotlib library is used to set the current axes to be a. Syntax: matplotlib.pyplot.sca(self, a) Parameters: This method accept the following parameters that are discussed below: a:This parameter is the current axes. Returns: This method returns the axes. Below examples illustrate the matplotlib.pyplot.sca() function in matplotlib.figure: Example 1: Python3 1== # Implementation of matplotlib function import matplotlib.pyplot as plt from scipy import sin, cos fig, ax = plt.subplots(2, 1) x = [1, 2, 3, 4, 5, 6, 7, 8, 9] y1 = sin(x) y2 = cos(x) plt.sca(ax[0]) plt.plot(x, y1) plt.sca(ax[1]) plt.plot(x, y2) fig.suptitle("""matplotlib.pyplot.sca() function Example\n\n""", fontweight ="bold") plt.show() Output: Example 2: Python3 1== # Implementation of matplotlib function import matplotlib.pyplot as plt fig, axes = plt.subplots(2, 2) axes = axes.flatten() for i in range(4): plt.sca(axes[i]) axes[i].text(0.5, 0.5, i + 1) fig.suptitle("""matplotlib.pyplot.sca() function Example\n\n""", fontweight ="bold") plt.show() Output: Comment More infoAdvertise with us Next Article Matplotlib.pyplot.sca() in Python S SHUBHAMSINGH10 Follow Improve Article Tags : Python Python-matplotlib Matplotlib Pyplot-class Practice Tags : python Similar Reads Matplotlib.pyplot.sci() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. There are various plots which can be used in Pyplot are Line Plot, Contour, Histogram, Scatter, 3D Plot, 2 min read Matplotlib.pyplot.specgram() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. matplotlib.pyplot.specgram() Function The specgram() function in pyplot module of matplotlib library is u 3 min read Matplotlib.pyplot.show() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. Sample Code - Python3 1== # sample code import matplotlib.pyplot as plt plt.plot([1, 2, 3, 4], [16, 4, 1, 2 min read Matplotlib.pyplot.xkcd() in Python One of the main process in Data Science is Data Visualization. Data Visualization refers to present a dataset in the form of graphs and pictures. We can identify upcoming trend by observing these Graphs. Python provides us with an amazing Data Visualization library in it which is Matplotlib which wa 2 min read Matplotlib.pyplot.savefig() in Python savefig() function in Python is used to save a plot created with Matplotlib to a file. It supports various formats like PNG, PDF, SVG, and more. This method allows you to specify additional parameters like file name, resolution, layout, and transparency, giving you control over the appearance and qu 3 min read Matplotlib.pyplot.yticks() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. Matplotlib.pyplot.yticks() Function The annotate() function in pyplot module of matplotlib library is use 2 min read Matplotlib.pyplot.xlim() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. There are various plots which can be used in Pyplot are Line Plot, Contour, Histogram, Scatter, 3D Plot, 2 min read Matplotlib.pyplot.ylim() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. matplotlib.pyplot.ylim() Function The ylim() function in pyplot module of matplotlib library is used to g 2 min read Matplotlib.pyplot.twiny() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. Sample Code Python3 1== # sample code import matplotlib.pyplot as plt plt.plot([1, 2, 3, 4], [16, 4, 1, 8 2 min read Matplotlib.pyplot.twinx() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. Sample Code Python3 1== # sample code import matplotlib.pyplot as plt plt.plot([1, 2, 3, 4], [16, 4, 1, 8 2 min read Like