# How do you get the current figure number in Python's Matplotlib?

MatplotlibPythonData Visualization

To get the current figure number in Python's Matplotlib, we can use plt.gcf().number.

## Steps

• Using figure(count) method, we can create a number of figures with count or windows name.
• To get the count of figures, use plt.gcf().number.

## Example

from matplotlib import pyplot as plt
fig = plt.figure(3)
print("Number of figures: ", plt.gcf().number)

## Output

Number of figures: 3
Updated on 17-Jun-2021 12:01:24