How to fix the Error: WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
I was using the data that shows the amount of particulate matter in each region in Seoul and trying to draw a graph. Since we are conducting the project in Korean, we had to write the labels on graph in Korean. However, I encountered the trouble the error saying, WARNING:matplotlib.font_manager:findfont: Font family 'NanumBarunGothic' not found.
Luckily, I solved the problem so I will show you how I solved the problem!
Before I solve the error, the graph looked like this:
The reason of the error is that I was not be able to use the 'NanumBarunGothic' font for Korean characters in my plots without encountering the error. I should have installed the font for the Korean characters.
!apt-get update -qq
!apt-get install fonts-nanum*
And then set the font to 'NanumBarunGothic' in Matplotlib:
import matplotlib.pyplot as plt
# Set the font family
plt.rc('font', family='NanumBarunGothic')
# Disable the font cache (this step may not be required, but it can help)
plt.rcParams['axes.unicode_minus'] = False
After writing this code, you should restart the runtime. Go to the "Runtime" menu and select "Restart runtime".
You should be able to see the Korean characters then.
The following graph is the one that I got after solving the problem.
I hope that whom are facing the same problem would be able to solve the problem!
