Jean-Paul Azzopardi
Jean-Paul Azzopardi

Reputation: 381

'MatplotlibDeprecationWarning' - Warning when trying to plot histogram

I'm trying to use matplotlib to plot a histogram but keep running into this error:

MatplotlibDeprecationWarning: The resize_event function was deprecated in Matplotlib 3.6 and will be removed two minor releases later. Use callbacks.process('resize_event', ResizeEvent(...)) instead.

Here's my code; feedback on how I can clean up the logical expressions also welcome.

lower_quartile = df['2020 Population'].quantile(0.25)
mid_quartile = df['2020 Population'].quantile(0.5)
upper_quartile = df['2020 Population'].quantile(0.75)

new_data = df.loc[df['2020 Population'] > lower_quartile]

final_2020_range = new_data.loc[df['2020 Population'] < upper_quartile]

check = final_2020_range['2020 Population']

plt.hist(check)

Upvotes: 8

Views: 14219

Answers (2)

diana
diana

Reputation: 21

I'm facing the same issue, I found a work-around:

import matplotlib
matplotlib.use('TkAgg')

Error will still be there, but now you can see plots.

Upvotes: 2

Kara Sevgili
Kara Sevgili

Reputation: 51

Seems like you can find your answer here: https://github.com/matplotlib/matplotlib/issues/23921

In short: it's a bug, and it will be corrected in 3.6.1

Upvotes: 5

Related Questions