Changing the Size of the Boxplots created using the data from a file

84 views Asked by At

I am new to python and I have been tying to change the size of the boxplots I created from the data extracted from a file but doesn't seem to be working for me. The font size did change but the size doesn't. Instead, I am just getting another empty graph.

Code

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline

data = pd.read_csv('Pokemon Names.csv')
fig, ax = plt.subplots(figsize=(10 ,5))
matplotlib.rcParams.update({'font.size': 14})
data.boxplot(by="Type_1")

Output

Output

1

There are 1 answers

0
Jdjd On

You want to pass the matplotlib axes to be used by the pandas boxplot function. Try this: data.boxplot(by="Type_1", ax=ax)