Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

add fonts to matplotlib from a particular location

import matplotlib.font_manager as fm
import matplotlib.pyplot as plt

font_path = [path] # font location
newfont = font_manager.findSystemFonts(font_Path) # find fonts
fm.fontManager.addfont(newfont) # add fonts
# then use the newfonts:
plt.rcParams['font.family'] = "newfont"

# Or In the latest matplotlib version > 3.2

font_path = 'Inter-Regular.otf'  # Your font path goes here
fm.fontManager.addfont(font_path)
prop = fm.FontProperties(fname=font_path)
#Use fonts 
plt.rcParams['font.family'] = 'sans-serif'
plt.rcParams['font.sans-serif'] = prop.get_name()
Comment

PREVIOUS NEXT
Code Example
Python :: type string python 
Python :: request headers in django 
Python :: OneHotEncoder() 
Python :: Python program to print all odd numbers in a range 
Python :: string to dictionary python 
Python :: combine dataframes with two matching columns 
Python :: python remove space from end of string 
Python :: create log in python 
Python :: python expressions 
Python :: Python - How To Check if a String Is a Palindrome 
Python :: python split word into letter pairs 
Python :: url settings 
Python :: file.open("file.txt); 
Python :: python code for where to save the figures 
Python :: with python 
Python :: delete key value in dictionary python 
Python :: kill python process with bash 
Python :: what is seaborn in python 
Python :: python code to exe file 
Python :: matplotlib dateformatter x axis 
Python :: pandas convert column to datetime 
Python :: how to create a virtual environment in anaconda 
Python :: python argparse file argument 
Python :: pandas read excel with two headers 
Python :: python http request params 
Python :: xml to excel python 
Python :: grouped bar chart matplotlib 
Python :: redirect parameters flask 
Python :: install coverage python 
Python :: pandas dataframe column based on another column 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =