Search code examples
pythonmatplotlibmosaic-plot

How to increase the size of a Matplotlib plot?


I made a mosaic plot with Matplotlib, but due to huge number of data points the plot is squeezed,the words overlap with each other. I want to increase the size of the plot. I tried:

plt.figure(figsize=()) 

It didn't work.

Here's my code:

from statsmodels.graphics.mosaicplot import mosaic
import matplotlib.pyplot as plt

plt.figure(figsize=(200,10)) #does not work
plt.rcParams['font.size'] = 10.0
mosaic(plants_sub, ['Symbol', 'Family'], gap=0.1);

Output:

enter image description here


Solution

  • add this:-

    plt.rcParams["figure.figsize"]=(enter your fig width, enter your fig height)