Print a list of fonts supported by plotnine¶
Setting fonts for plotnine¶
When making a graph with plotnine, you can use element_text(family=...)
to pick a font.
import pandas as pd
from plotnine import *
df = pd.read_csv('countries.csv')
(
ggplot(df)
+ aes(x='gdp_per_capita', y='life_expectancy')
+ geom_point()
+ labs(title="Life Expectancy vs GDP (per capita)")
+ theme(plot_title=element_text(family='Frutiger Bold'))
)
<ggplot: (321267264)>
List of fonts supported by plotnine¶
Sometimes you don't know the "real" name of a font, and when you use family=
you might get an error like findfont: Font family ['Frutiger'] not found. Falling back to DejaVu Sans.
.
What fonts are available? Let's ask maptlotlib!
import matplotlib.font_manager
from IPython.core.display import HTML
def make_html(fontname):
return "<p>{font}: <span style='font-family:{font}; font-size: 24px;'>{font}</p>".format(font=fontname)
font_names = sorted(set([f.name for f in matplotlib.font_manager.fontManager.ttflist]))
code = "\n".join([make_html(font) for font in font_names])
HTML("<div style='column-count: 2;'>{}</div>".format(code))
{font}: {font}
".format(font=fontname) font_names = sorted(set([f.name for f in matplotlib.font_manager.fontManager.ttflist])) code = "\n".join([make_html(font) for font in font_names]) HTML(".Aqua Kana: .Aqua Kana
.Arabic UI Display: .Arabic UI Display
.Arabic UI Text: .Arabic UI Text
.Helvetica Neue DeskInterface: .Helvetica Neue DeskInterface
.Keyboard: .Keyboard
.New York: .New York
.SF Compact Display: .SF Compact Display
.SF Compact Rounded: .SF Compact Rounded
.SF Compact Text: .SF Compact Text
.SF NS Display Condensed: .SF NS Display Condensed
.SF NS Mono: .SF NS Mono
.SF NS Rounded: .SF NS Rounded
.SF NS Text Condensed: .SF NS Text Condensed
Al Bayan: Al Bayan
Al Nile: Al Nile
Al Tarikh: Al Tarikh
American Typewriter: American Typewriter
Andale Mono: Andale Mono
Apple Braille: Apple Braille
Apple Chancery: Apple Chancery
Apple LiGothic: Apple LiGothic
Apple LiSung: Apple LiSung
Apple SD Gothic Neo: Apple SD Gothic Neo
Apple Symbols: Apple Symbols
AppleGothic: AppleGothic
AppleMyungjo: AppleMyungjo
Arial: Arial
Arial Black: Arial Black
Arial Hebrew: Arial Hebrew
Arial Narrow: Arial Narrow
Arial Rounded MT Bold: Arial Rounded MT Bold
Arial Unicode MS: Arial Unicode MS
Athelas: Athelas
Avenir: Avenir
Avenir Next: Avenir Next
Avenir Next Condensed: Avenir Next Condensed
Ayuthaya: Ayuthaya
Baghdad: Baghdad
Baloo: Baloo
Baloo Bhai: Baloo Bhai
Baloo Bhaijaan: Baloo Bhaijaan
Baloo Bhaina: Baloo Bhaina
Baloo Chettan: Baloo Chettan
Baloo Da: Baloo Da
Baloo Paaji: Baloo Paaji
Baloo Tamma: Baloo Tamma
Baloo Tammudu: Baloo Tammudu
Baloo Thambi: Baloo Thambi
Bangers: Bangers
Bangla MN: Bangla MN
Bangla Sangam MN: Bangla Sangam MN
Baoli SC: Baoli SC
Baskerville: Baskerville
Bebas Neue: Bebas Neue
Beirut: Beirut
BiauKai: BiauKai
Big Caslon: Big Caslon
Bitstream Vera Sans: Bitstream Vera Sans
Bitstream Vera Sans Mono: Bitstream Vera Sans Mono
Bitstream Vera Serif: Bitstream Vera Serif
Bodoni 72: Bodoni 72
Bodoni 72 Oldstyle: Bodoni 72 Oldstyle
Bodoni 72 Smallcaps: Bodoni 72 Smallcaps
Bodoni Ornaments: Bodoni Ornaments
Bradley Hand: Bradley Hand
Brush Script MT: Brush Script MT
Cambay Devanagari: Cambay Devanagari
Chalkboard: Chalkboard
Chalkboard SE: Chalkboard SE
Chalkduster: Chalkduster
Charter: Charter
Cochin: Cochin
Comic Sans MS: Comic Sans MS
Copperplate: Copperplate
Corsiva Hebrew: Corsiva Hebrew
Courier New: Courier New
DIN Alternate: DIN Alternate
DIN Condensed: DIN Condensed
Damascus: Damascus
DecoType Naskh: DecoType Naskh
DejaVu Sans: DejaVu Sans
DejaVu Sans Display: DejaVu Sans Display
DejaVu Sans Mono: DejaVu Sans Mono
DejaVu Serif: DejaVu Serif
DejaVu Serif Display: DejaVu Serif Display
Devanagari MT: Devanagari MT
Devanagari Sangam MN: Devanagari Sangam MN
Didot: Didot
Diwan Kufi: Diwan Kufi
Diwan Thuluth: Diwan Thuluth
East Syriac Adiabene: East Syriac Adiabene
East Syriac Ctesiphon: East Syriac Ctesiphon
Estrangelo Antioch: Estrangelo Antioch
Estrangelo Edessa: Estrangelo Edessa
Estrangelo Midyat: Estrangelo Midyat
Estrangelo Nisibin: Estrangelo Nisibin
Estrangelo Nisibin Outline: Estrangelo Nisibin Outline
Estrangelo Quenneshrin: Estrangelo Quenneshrin
Estrangelo Talada: Estrangelo Talada
Estrangelo TurAbdin: Estrangelo TurAbdin
Euphemia UCAS: Euphemia UCAS
Farah: Farah
Farisi: Farisi
Feast of Flesh BB: Feast of Flesh BB
Frutiger Bold: Frutiger Bold
Frutiger LT: Frutiger LT
Frutiger LT Std: Frutiger LT Std
Frutiger Light Condensed: Frutiger Light Condensed
Frutiger Ultra Black: Frutiger Ultra Black
Futura: Futura
Galvji: Galvji
Geeza Pro: Geeza Pro
Georgia: Georgia
Gill Sans: Gill Sans
Goha-Tibeb Zemen: Goha-Tibeb Zemen
Gotu: Gotu
Gujarati MT: Gujarati MT
Gujarati Sangam MN: Gujarati Sangam MN
GungSeo: GungSeo
Gurmukhi MN: Gurmukhi MN
Gurmukhi MT: Gurmukhi MT
Gurmukhi Sangam MN: Gurmukhi Sangam MN
Hannotate SC: Hannotate SC
HanziPen SC: HanziPen SC
HeadLineA: HeadLineA
Hei: Hei
Heiti TC: Heiti TC
Helvetica: Helvetica
Helvetica Neue: Helvetica Neue
Herculanum: Herculanum
Hiragino Maru Gothic Pro: Hiragino Maru Gothic Pro
Hiragino Mincho ProN: Hiragino Mincho ProN
Hiragino Sans: Hiragino Sans
Hiragino Sans CNS: Hiragino Sans CNS
Hiragino Sans GB: Hiragino Sans GB
Hoefler Text: Hoefler Text
ITF Devanagari: ITF Devanagari
Impact: Impact
InaiMathi: InaiMathi
Inconsolata: Inconsolata
Iowan Old Style: Iowan Old Style
Jaini: Jaini
Jaini Purva: Jaini Purva
Kai: Kai
Kailasa: Kailasa
Kaiti SC: Kaiti SC
Kannada MN: Kannada MN
Kannada Sangam MN: Kannada Sangam MN
Kefa: Kefa
Khmer MN: Khmer MN
Khmer Sangam MN: Khmer Sangam MN
Klee: Klee
Kohinoor Bangla: Kohinoor Bangla
Kohinoor Devanagari: Kohinoor Devanagari
Kohinoor Gujarati: Kohinoor Gujarati
Kohinoor Telugu: Kohinoor Telugu
Kokonor: Kokonor
Krungthep: Krungthep
KufiStandardGK: KufiStandardGK
Lahore Gurmukhi: Lahore Gurmukhi
Lantinghei SC: Lantinghei SC
Lao MN: Lao MN
Lao Sangam MN: Lao Sangam MN
LiHei Pro: LiHei Pro
LiSong Pro: LiSong Pro
Libian SC: Libian SC
LingWai SC: LingWai SC
LingWai TC: LingWai TC
Lucida Grande: Lucida Grande
Luminari: Luminari
Luxi Mono: Luxi Mono
Luxi Sans: Luxi Sans
Luxi Serif: Luxi Serif
MICR: MICR
MICR Encoding: MICR Encoding
Maku: Maku
Malayalam MN: Malayalam MN
Malayalam Sangam MN: Malayalam Sangam MN
Marion: Marion
Marker Felt: Marker Felt
Menlo: Menlo
Microsoft Sans Serif: Microsoft Sans Serif
Mishafi: Mishafi
Mishafi Gold: Mishafi Gold
Modak: Modak
Mshtakan: Mshtakan
Mukta: Mukta
Mukta Mahee: Mukta Mahee
Mukta Malar: Mukta Malar
Mukta Vaani: Mukta Vaani
Muna: Muna
Myanmar MN: Myanmar MN
Myanmar Sangam MN: Myanmar Sangam MN
Nadeem: Nadeem
Nanum Brush Script: Nanum Brush Script
Nanum Gothic: Nanum Gothic
Nanum Myeongjo: Nanum Myeongjo
New Peninim MT: New Peninim MT
Noteworthy: Noteworthy
Noto Nastaliq Urdu: Noto Nastaliq Urdu
Noto Sans Armenian: Noto Sans Armenian
Noto Sans Avestan: Noto Sans Avestan
Noto Sans Bamum: Noto Sans Bamum
Noto Sans Batak: Noto Sans Batak
Noto Sans Brahmi: Noto Sans Brahmi
Noto Sans Buginese: Noto Sans Buginese
Noto Sans Buhid: Noto Sans Buhid
Noto Sans Carian: Noto Sans Carian
Noto Sans Chakma: Noto Sans Chakma
Noto Sans Cham: Noto Sans Cham
Noto Sans Coptic: Noto Sans Coptic
Noto Sans Cuneiform: Noto Sans Cuneiform
Noto Sans Cypriot: Noto Sans Cypriot
Noto Sans Egyptian Hieroglyphs: Noto Sans Egyptian Hieroglyphs
Noto Sans Glagolitic: Noto Sans Glagolitic
Noto Sans Gothic: Noto Sans Gothic
Noto Sans Hanunoo: Noto Sans Hanunoo
Noto Sans Imperial Aramaic: Noto Sans Imperial Aramaic
Noto Sans Inscriptional Pahlavi: Noto Sans Inscriptional Pahlavi
Noto Sans Inscriptional Parthian: Noto Sans Inscriptional Parthian
Noto Sans Javanese: Noto Sans Javanese
Noto Sans Kaithi: Noto Sans Kaithi
Noto Sans Kannada: Noto Sans Kannada
Noto Sans Kayah Li: Noto Sans Kayah Li
Noto Sans Kharoshthi: Noto Sans Kharoshthi
Noto Sans Lepcha: Noto Sans Lepcha
Noto Sans Limbu: Noto Sans Limbu
Noto Sans Linear B: Noto Sans Linear B
Noto Sans Lisu: Noto Sans Lisu
Noto Sans Lycian: Noto Sans Lycian
Noto Sans Lydian: Noto Sans Lydian
Noto Sans Mandaic: Noto Sans Mandaic
Noto Sans Meetei Mayek: Noto Sans Meetei Mayek
Noto Sans Mongolian: Noto Sans Mongolian
Noto Sans Myanmar: Noto Sans Myanmar
Noto Sans NKo: Noto Sans NKo
Noto Sans New Tai Lue: Noto Sans New Tai Lue
Noto Sans Ogham: Noto Sans Ogham
Noto Sans Ol Chiki: Noto Sans Ol Chiki
Noto Sans Old Italic: Noto Sans Old Italic
Noto Sans Old Persian: Noto Sans Old Persian
Noto Sans Old South Arabian: Noto Sans Old South Arabian
Noto Sans Old Turkic: Noto Sans Old Turkic
Noto Sans Oriya: Noto Sans Oriya
Noto Sans Osmanya: Noto Sans Osmanya
Noto Sans PhagsPa: Noto Sans PhagsPa
Noto Sans Phoenician: Noto Sans Phoenician
Noto Sans Rejang: Noto Sans Rejang
Noto Sans Runic: Noto Sans Runic
Noto Sans Samaritan: Noto Sans Samaritan
Noto Sans Saurashtra: Noto Sans Saurashtra
Noto Sans Shavian: Noto Sans Shavian
Noto Sans Sundanese: Noto Sans Sundanese
Noto Sans Syloti Nagri: Noto Sans Syloti Nagri
Noto Sans Syriac: Noto Sans Syriac
Noto Sans Tagalog: Noto Sans Tagalog
Noto Sans Tagbanwa: Noto Sans Tagbanwa
Noto Sans Tai Le: Noto Sans Tai Le
Noto Sans Tai Tham: Noto Sans Tai Tham
Noto Sans Tai Viet: Noto Sans Tai Viet
Noto Sans Thaana: Noto Sans Thaana
Noto Sans Tifinagh: Noto Sans Tifinagh
Noto Sans Ugaritic: Noto Sans Ugaritic
Noto Sans Vai: Noto Sans Vai
Noto Sans Yi: Noto Sans Yi
Noto Serif Balinese: Noto Serif Balinese
Noto Serif Kannada: Noto Serif Kannada
Noto Serif Myanmar: Noto Serif Myanmar
Optima: Optima
Oriya MN: Oriya MN
Oriya Sangam MN: Oriya Sangam MN
Osaka: Osaka
PCMyungjo: PCMyungjo
PSL Ornanong Pro: PSL Ornanong Pro
PT Mono: PT Mono
PT Sans: PT Sans
PT Serif: PT Serif
PT Serif Caption: PT Serif Caption
Palatino: Palatino
Papyrus: Papyrus
Phosphate: Phosphate
PilGi: PilGi
PingFang HK: PingFang HK
Plantagenet Cherokee: Plantagenet Cherokee
Raanana: Raanana
Rockwell: Rockwell
STFangsong: STFangsong
STHeiti: STHeiti
STIXGeneral: STIXGeneral
STIXIntegralsD: STIXIntegralsD
STIXIntegralsSm: STIXIntegralsSm
STIXIntegralsUp: STIXIntegralsUp
STIXIntegralsUpD: STIXIntegralsUpD
STIXIntegralsUpSm: STIXIntegralsUpSm
STIXNonUnicode: STIXNonUnicode
STIXSizeFiveSym: STIXSizeFiveSym
STIXSizeFourSym: STIXSizeFourSym
STIXSizeOneSym: STIXSizeOneSym
STIXSizeThreeSym: STIXSizeThreeSym
STIXSizeTwoSym: STIXSizeTwoSym
STIXVariants: STIXVariants
Sana: Sana
Sathu: Sathu
Savoye LET: Savoye LET
Seravek: Seravek
Serto Batnan: Serto Batnan
Serto Jerusalem: Serto Jerusalem
Serto Jerusalem Outline: Serto Jerusalem Outline
Serto Kharput: Serto Kharput
Serto Malankara: Serto Malankara
Serto Mardin: Serto Mardin
Serto Urhoy: Serto Urhoy
Shobhika: Shobhika
Shree Devanagari 714: Shree Devanagari 714
SignPainter: SignPainter
Silom: Silom
Sinhala MN: Sinhala MN
Sinhala Sangam MN: Sinhala Sangam MN
Skia: Skia
Snell Roundhand: Snell Roundhand
Songti SC: Songti SC
Sukhumvit Set: Sukhumvit Set
Superclarendon: Superclarendon
Symbol: Symbol
System Font: System Font
Tahoma: Tahoma
Tamil MN: Tamil MN
Tamil Sangam MN: Tamil Sangam MN
Telugu MN: Telugu MN
Telugu Sangam MN: Telugu Sangam MN
Thonburi: Thonburi
Times: Times
Times New Roman: Times New Roman
Tiro Bangla: Tiro Bangla
Tiro Gurmukhi: Tiro Gurmukhi
Tiro Hindi: Tiro Hindi
Tiro Kannada: Tiro Kannada
Tiro Marathi: Tiro Marathi
Tiro Sanskrit: Tiro Sanskrit
Tiro Tamil: Tiro Tamil
Tiro Telugu: Tiro Telugu
Toppan Bunkyu Gothic: Toppan Bunkyu Gothic
Toppan Bunkyu Midashi Gothic: Toppan Bunkyu Midashi Gothic
Toppan Bunkyu Midashi Mincho: Toppan Bunkyu Midashi Mincho
Toppan Bunkyu Mincho: Toppan Bunkyu Mincho
Trattatello: Trattatello
Trebuchet MS: Trebuchet MS
Tsukushi A Round Gothic: Tsukushi A Round Gothic
Tsukushi B Round Gothic: Tsukushi B Round Gothic
Verdana: Verdana
Waseem: Waseem
Wawati SC: Wawati SC
Wawati TC: Wawati TC
Webdings: Webdings
Weibei SC: Weibei SC
Weibei TC: Weibei TC
Wingdings: Wingdings
Wingdings 2: Wingdings 2
Wingdings 3: Wingdings 3
Xingkai SC: Xingkai SC
YuGothic: YuGothic
YuKyokasho Yoko: YuKyokasho Yoko
YuMincho: YuMincho
Yuanti SC: Yuanti SC
Yuppy SC: Yuppy SC
Yuppy TC: Yuppy TC
Zapf Dingbats: Zapf Dingbats
Zapfino: Zapfino
cmb10: cmb10
cmex10: cmex10
cmmi10: cmmi10
cmr10: cmr10
cmss10: cmss10
cmsy10: cmsy10
cmtt10: cmtt10