How to show an Axes Subplot in Python?

PythonMatplotlibServer Side ProgrammingProgramming

To show an axes subplot in Python, we can use show() method. When multiple figures are created, then those images are displayed using show() method.

Steps

  • Create x and y data points using numpy.
  • Plot x and y using plot() method.
  • To display the figure, use show() method.

Example

from matplotlib import pyplot as plt
import numpy as np
plt.rcParams["figure.figsize"] = [7.00, 3.50]
plt.rcParams["figure.autolayout"] = True
x = np.arange(10)
y = np.exp(x)
plt.plot(x, y)
plt.show()

Output

raja
Published on 07-May-2021 07:55:25
Advertisements