matplotlib 的默认字体和默认字体系列
matplotlib 的默认字体和默认字体系列
- 查看默认字体和默认字体系列
- 查看默认字体系列下包含的字体
- 查看 plt.rcParams 设置的所有参数
- 查看所有支持的字体格式
- 设置默认字体
- 方法1:
- 方法2
今天给大家介绍一下
matplotlib
包中的默认字体以及默认字体系列。
查看默认字体和默认字体系列
使用如下代码我们就可以轻松获取到默认字体与默认字体系列:
import matplotlib.pyplot as pltprint(plt.rcParams["font.family"][0])
print(plt.rcParams["font.sans-serif"][0])
"""
result:
sans-serif
DejaVu Sans
"""
查看默认字体系列下包含的字体
我们知道,默认字体系列有 'serif', 'sans-serif', 'monospace', 'fantasy' or 'cursive'
,我们可以使用如下代码查看其系列下包含的字体。
import matplotlib.pyplot as pltprint(plt.rcParams["font.sans-serif"])
"""
result:
['DejaVu Sans', 'Bitstream Vera Sans', 'Computer Modern Sans Serif', 'Lucida Grande', 'Verdana', 'Geneva', 'Lucid', 'Arial', 'Helvetica', 'Avant Garde', 'sans-serif']
"""
其他字体系列下的字体可以替换 font.sans-serif
为其他的字体系列名称即可。
查看 plt.rcParams 设置的所有参数
import matplotlib.pyplot as pltprint(plt.rcParams.keys())
"""
result:
KeysView(RcParams({'_internal.classic_mode': False,'agg.path.chunksize': 0,'animation.bitrate': -1,'animation.codec': 'h264','animation.convert_args': ['-layers', 'OptimizePlus'],'animation.convert_path': 'convert','animation.embed_limit': 20.0,'animation.ffmpeg_args': [],'animation.ffmpeg_path': 'ffmpeg','animation.frame_format': 'png','animation.html': 'none','animation.writer': 'ffmpeg','axes.autolimit_mode': 'data','axes.axisbelow': 'line','axes.edgecolor': 'black','axes.facecolor': 'white','axes.formatter.limits': [-5, 6],'axes.formatter.min_exponent': 0,'axes.formatter.offset_threshold': 4,'axes.formatter.use_locale': False,'axes.formatter.use_mathtext': False,'axes.formatter.useoffset': True,'axes.grid': False,'axes.grid.axis': 'both','axes.grid.which': 'major','axes.labelcolor': 'black','axes.labelpad': 4.0,'axes.labelsize': 'medium','axes.labelweight': 'normal','axes.linewidth': 0.8,'axes.prop_cycle': cycler('color', ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf']),'axes.spines.bottom': True,'axes.spines.left': True,'axes.spines.right': True,'axes.spines.top': True,'axes.titlecolor': 'auto','axes.titlelocation': 'center','axes.titlepad': 6.0,'axes.titlesize': 'large','axes.titleweight': 'normal','axes.titley': None,'axes.unicode_minus': True,'axes.xmargin': 0.05,'axes.ymargin': 0.05,'axes.zmargin': 0.05,'axes3d.grid': True,'axes3d.xaxis.panecolor': (0.95, 0.95, 0.95, 0.5),'axes3d.yaxis.panecolor': (0.9, 0.9, 0.9, 0.5),'axes3d.zaxis.panecolor': (0.925, 0.925, 0.925, 0.5),'backend': 'QtAgg','backend_fallback': True,'boxplot.bootstrap': None,'boxplot.boxprops.color': 'black','boxplot.boxprops.linestyle': '-','boxplot.boxprops.linewidth': 1.0,'boxplot.capprops.color': 'black','boxplot.capprops.linestyle': '-','boxplot.capprops.linewidth': 1.0,'boxplot.flierprops.color': 'black','boxplot.flierprops.linestyle': 'none','boxplot.flierprops.linewidth': 1.0,'boxplot.flierprops.marker': 'o','boxplot.flierprops.markeredgecolor': 'black','boxplot.flierprops.markeredgewidth': 1.0,'boxplot.flierprops.markerfacecolor': 'none','boxplot.flierprops.markersize': 6.0,'boxplot.meanline': False,'boxplot.meanprops.color': 'C2','boxplot.meanprops.linestyle': '--','boxplot.meanprops.linewidth': 1.0,'boxplot.meanprops.marker': '^','boxplot.meanprops.markeredgecolor': 'C2','boxplot.meanprops.markerfacecolor': 'C2','boxplot.meanprops.markersize': 6.0,'boxplot.medianprops.color': 'C1','boxplot.medianprops.linestyle': '-','boxplot.medianprops.linewidth': 1.0,'boxplot.notch': False,'boxplot.patchartist': False,'boxplot.showbox': True,'boxplot.showcaps': True,'boxplot.showfliers': True,'boxplot.showmeans': False,'boxplot.vertical': True,'boxplot.whiskerprops.color': 'black','boxplot.whiskerprops.linestyle': '-','boxplot.whiskerprops.linewidth': 1.0,'boxplot.whiskers': 1.5,'contour.algorithm': 'mpl2014','contour.corner_mask': True,'contour.linewidth': None,'contour.negative_linestyle': 'dashed','date.autoformatter.day': '%Y-%m-%d','date.autoformatter.hour': '%m-%d %H','date.autoformatter.microsecond': '%M:%S.%f','date.autoformatter.minute': '%d %H:%M','date.autoformatter.month': '%Y-%m','date.autoformatter.second': '%H:%M:%S','date.autoformatter.year': '%Y','date.converter': 'auto','date.epoch': '1970-01-01T00:00:00','date.interval_multiples': True,'docstring.hardcopy': False,'errorbar.capsize': 0.0,'figure.autolayout': False,'figure.constrained_layout.h_pad': 0.04167,'figure.constrained_layout.hspace': 0.02,'figure.constrained_layout.use': False,'figure.constrained_layout.w_pad': 0.04167,'figure.constrained_layout.wspace': 0.02,'figure.dpi': 100.0,'figure.edgecolor': 'white','figure.facecolor': 'white','figure.figsize': [6.4, 4.8],'figure.frameon': True,'figure.hooks': [],'figure.labelsize': 'large','figure.labelweight': 'normal','figure.max_open_warning': 20,'figure.raise_window': True,'figure.subplot.bottom': 0.11,'figure.subplot.hspace': 0.2,'figure.subplot.left': 0.125,'figure.subplot.right': 0.9,'figure.subplot.top': 0.88,'figure.subplot.wspace': 0.2,'figure.titlesize': 'large','figure.titleweight': 'normal','font.cursive': ['Apple Chancery','Textile','Zapf Chancery','Sand','Script MT','Felipa','Comic Neue','Comic Sans MS','cursive'],'font.family': ['sans-serif'],'font.fantasy': ['Chicago','Charcoal','Impact','Western','Humor Sans','xkcd','fantasy'],'font.monospace': ['DejaVu Sans Mono','Bitstream Vera Sans Mono','Computer Modern Typewriter','Andale Mono','Nimbus Mono L','Courier New','Courier','Fixed','Terminal','monospace'],'font.sans-serif': ['DejaVu Sans','Bitstream Vera Sans','Computer Modern Sans Serif','Lucida Grande','Verdana','Geneva','Lucid','Arial','Helvetica','Avant Garde','sans-serif'],'font.serif': ['DejaVu Serif','Bitstream Vera Serif','Computer Modern Roman','New Century Schoolbook','Century Schoolbook L','Utopia','ITC Bookman','Bookman','Nimbus Roman No9 L','Times New Roman','Times','Palatino','Charter','serif'],'font.size': 10.0,'font.stretch': 'normal','font.style': 'normal','font.variant': 'normal','font.weight': 'normal','grid.alpha': 1.0,'grid.color': '#b0b0b0','grid.linestyle': '-','grid.linewidth': 0.8,'hatch.color': 'black','hatch.linewidth': 1.0,'hist.bins': 10,'image.aspect': 'equal','image.cmap': 'viridis','image.composite_image': True,'image.interpolation': 'antialiased','image.lut': 256,'image.origin': 'upper','image.resample': True,'interactive': False,'keymap.back': ['left', 'c', 'backspace', 'MouseButton.BACK'],'keymap.copy': ['ctrl+c', 'cmd+c'],'keymap.forward': ['right', 'v', 'MouseButton.FORWARD'],'keymap.fullscreen': ['f', 'ctrl+f'],'keymap.grid': ['g'],'keymap.grid_minor': ['G'],'keymap.help': ['f1'],'keymap.home': ['h', 'r', 'home'],'keymap.pan': ['p'],'keymap.quit': ['ctrl+w', 'cmd+w', 'q'],'keymap.quit_all': [],'keymap.save': ['s', 'ctrl+s'],'keymap.xscale': ['k', 'L'],'keymap.yscale': ['l'],'keymap.zoom': ['o'],'legend.borderaxespad': 0.5,'legend.borderpad': 0.4,'legend.columnspacing': 2.0,'legend.edgecolor': '0.8','legend.facecolor': 'inherit','legend.fancybox': True,'legend.fontsize': 'medium','legend.framealpha': 0.8,'legend.frameon': True,'legend.handleheight': 0.7,'legend.handlelength': 2.0,'legend.handletextpad': 0.8,'legend.labelcolor': 'None','legend.labelspacing': 0.5,'legend.loc': 'best','legend.markerscale': 1.0,'legend.numpoints': 1,'legend.scatterpoints': 1,'legend.shadow': False,'legend.title_fontsize': None,'lines.antialiased': True,'lines.color': 'C0','lines.dash_capstyle': <CapStyle.butt: 'butt'>,'lines.dash_joinstyle': <JoinStyle.round: 'round'>,'lines.dashdot_pattern': [6.4, 1.6, 1.0, 1.6],'lines.dashed_pattern': [3.7, 1.6],'lines.dotted_pattern': [1.0, 1.65],'lines.linestyle': '-','lines.linewidth': 1.5,'lines.marker': 'None','lines.markeredgecolor': 'auto','lines.markeredgewidth': 1.0,'lines.markerfacecolor': 'auto','lines.markersize': 6.0,'lines.scale_dashes': True,'lines.solid_capstyle': <CapStyle.projecting: 'projecting'>,'lines.solid_joinstyle': <JoinStyle.round: 'round'>,'markers.fillstyle': 'full','mathtext.bf': 'sans:bold','mathtext.cal': 'cursive','mathtext.default': 'it','mathtext.fallback': 'cm','mathtext.fontset': 'dejavusans','mathtext.it': 'sans:italic','mathtext.rm': 'sans','mathtext.sf': 'sans','mathtext.tt': 'monospace','patch.antialiased': True,'patch.edgecolor': 'black','patch.facecolor': 'C0','patch.force_edgecolor': False,'patch.linewidth': 1.0,'path.effects': [],'path.simplify': True,'path.simplify_threshold': 0.111111111111,'path.sketch': None,'path.snap': True,'pcolor.shading': 'auto','pcolormesh.snap': True,'pdf.compression': 6,'pdf.fonttype': 3,'pdf.inheritcolor': False,'pdf.use14corefonts': False,'pgf.preamble': '','pgf.rcfonts': True,'pgf.texsystem': 'xelatex','polaraxes.grid': True,'ps.distiller.res': 6000,'ps.fonttype': 3,'ps.papersize': 'letter','ps.useafm': False,'ps.usedistiller': None,'savefig.bbox': None,'savefig.directory': '~','savefig.dpi': 'figure','savefig.edgecolor': 'auto','savefig.facecolor': 'auto','savefig.format': 'png','savefig.orientation': 'portrait','savefig.pad_inches': 0.1,'savefig.transparent': False,'scatter.edgecolors': 'face','scatter.marker': 'o','svg.fonttype': 'path','svg.hashsalt': None,'svg.image_inline': True,'text.antialiased': True,'text.color': 'black','text.hinting': 'force_autohint','text.hinting_factor': 8,'text.kerning_factor': 0,'text.latex.preamble': '','text.parse_math': True,'text.usetex': False,'timezone': 'UTC','tk.window_focus': False,'toolbar': 'toolbar2','webagg.address': '127.0.0.1','webagg.open_in_browser': True,'webagg.port': 8988,'webagg.port_retries': 50,'xaxis.labellocation': 'center','xtick.alignment': 'center','xtick.bottom': True,'xtick.color': 'black','xtick.direction': 'out','xtick.labelbottom': True,'xtick.labelcolor': 'inherit','xtick.labelsize': 'medium','xtick.labeltop': False,'xtick.major.bottom': True,'xtick.major.pad': 3.5,'xtick.major.size': 3.5,'xtick.major.top': True,'xtick.major.width': 0.8,'xtick.minor.bottom': True,'xtick.minor.pad': 3.4,'xtick.minor.size': 2.0,'xtick.minor.top': True,'xtick.minor.visible': False,'xtick.minor.width': 0.6,'xtick.top': False,'yaxis.labellocation': 'center','ytick.alignment': 'center_baseline','ytick.color': 'black','ytick.direction': 'out','ytick.labelcolor': 'inherit','ytick.labelleft': True,'ytick.labelright': False,'ytick.labelsize': 'medium','ytick.left': True,'ytick.major.left': True,'ytick.major.pad': 3.5,'ytick.major.right': True,'ytick.major.size': 3.5,'ytick.major.width': 0.8,'ytick.minor.left': True,'ytick.minor.pad': 3.4,'ytick.minor.right': True,'ytick.minor.size': 2.0,'ytick.minor.visible': False,'ytick.minor.width': 0.6,'ytick.right': False}))
"""
查看所有支持的字体格式
那么如何查看matplotlib 支持的所有字体呢?可以使用如下代码:
import matplotliba = sorted([f.name for f in matplotlib.font_manager.fontManager.ttflist])
for i in a:print(i)
"""
result:
Academy Engraved LET
Academy Engraved LET
Adobe Arabic
Adobe Arabic
Adobe Arabic
Adobe Arabic
Adobe Arabic
Adobe Arabic
Adobe Arabic
Adobe Arabic
Adobe Caslon Pro
Adobe Caslon Pro
Adobe Caslon Pro
Adobe Caslon Pro
Adobe Caslon Pro
Adobe Caslon Pro
Adobe Caslon Pro
Adobe Caslon Pro
Adobe Caslon Pro
Adobe Caslon Pro
Adobe Caslon Pro
Adobe Caslon Pro
Adobe Devanagari
Adobe Devanagari
Adobe Devanagari
Adobe Devanagari
Adobe Devanagari
Adobe Devanagari
Adobe Devanagari
Adobe Devanagari
Adobe Fan Heiti Std
Adobe Fan Heiti Std
Adobe Fangsong Std
Adobe Fangsong Std
Adobe Garamond Pro
Adobe Garamond Pro
Adobe Garamond Pro
Adobe Garamond Pro
Adobe Garamond Pro
Adobe Garamond Pro
Adobe Garamond Pro
Adobe Garamond Pro
Adobe Gothic Std
Adobe Gothic Std
Adobe Hebrew
Adobe Hebrew
Adobe Hebrew
Adobe Hebrew
Adobe Hebrew
Adobe Hebrew
Adobe Hebrew
Adobe Hebrew
Adobe Heiti Std
Adobe Heiti Std
Adobe Kaiti Std
Adobe Kaiti Std
Adobe Ming Std
Adobe Ming Std
Adobe Myungjo Std
Adobe Myungjo Std
Adobe Naskh
Adobe Naskh
Adobe Song Std
Adobe Song Std
Arial
Arial
Arial
Arial
Arial
Arial
Arial
Arial
Arial
Arial
Bahnschrift
Bahnschrift
Birch Std
Birch Std
Blackletter686 BT
Blackletter686 BT
Blackoak Std
Blackoak Std
Broadway BT
Broadway BT
Brush Script Std
Brush Script Std
Calibri
Calibri
Calibri
Calibri
Calibri
Calibri
Calibri
Calibri
Calibri
Calibri
Calibri
Calibri
Calligraph421 BT
Calligraph421 BT
Cambria
Cambria
Cambria
Cambria
Cambria
Cambria
Cambria
Cambria
Candara
Candara
Candara
Candara
Candara
Candara
Candara
Candara
Candara
Candara
Candara
Candara
Cataneo BT
Cataneo BT
Chaparral Pro
Chaparral Pro
Chaparral Pro
Chaparral Pro
Chaparral Pro
Chaparral Pro
Chaparral Pro
Chaparral Pro
Chaparral Pro
Chaparral Pro
Charlemagne Std
Charlemagne Std
Comic Sans MS
Comic Sans MS
Comic Sans MS
Comic Sans MS
Comic Sans MS
Comic Sans MS
Comic Sans MS
Comic Sans MS
Consolas
Consolas
Consolas
Consolas
Consolas
Consolas
Consolas
Consolas
Constantia
Constantia
Constantia
Constantia
Constantia
Constantia
Constantia
Constantia
Cooper Std
Cooper Std
Cooper Std
Cooper Std
Corbel
Corbel
Corbel
Corbel
Corbel
Corbel
Corbel
Corbel
Corbel
Corbel
Corbel
Corbel
Courier New
Courier New
Courier New
Courier New
Courier New
Courier New
Courier New
Courier New
DFPHaiBaoW12-GB
DejaVu Sans
DejaVu Sans
DejaVu Sans
DejaVu Sans
DejaVu Sans Display
DejaVu Sans Mono
DejaVu Sans Mono
DejaVu Sans Mono
DejaVu Sans Mono
DejaVu Serif
DejaVu Serif
DejaVu Serif
DejaVu Serif
DejaVu Serif Display
DengXian
DengXian
DengXian
DengXian
DengXian
DengXian
Ebrima
Ebrima
Ebrima
Ebrima
FangSong
FangSong
Franklin Gothic Medium
Franklin Gothic Medium
Franklin Gothic Medium
Franklin Gothic Medium
Gabriola
Gabriola
Gadugi
Gadugi
Gadugi
Gadugi
Georgia
Georgia
Georgia
Georgia
Georgia
Georgia
Georgia
Georgia
Giddyup Std
Giddyup Std
Highlight LET
Highlight LET
Hobo Std
Hobo Std
HolidayPi BT
HolidayPi BT
HoloLens MDL2 Assets
HoloLens MDL2 Assets
Impact
Impact
Ink Free
Ink Free
Javanese Text
Javanese Text
John Handy LET
John Handy LET
Jokerman LET
Jokerman LET
KaiTi
KaiTi
Kozuka Gothic Pr6N
Kozuka Gothic Pr6N
Kozuka Gothic Pr6N
Kozuka Gothic Pr6N
Kozuka Gothic Pr6N
Kozuka Gothic Pr6N
Kozuka Gothic Pr6N
Kozuka Gothic Pr6N
Kozuka Gothic Pr6N
Kozuka Gothic Pr6N
Kozuka Gothic Pr6N
Kozuka Gothic Pr6N
Kozuka Gothic Pro
Kozuka Gothic Pro
Kozuka Gothic Pro
Kozuka Gothic Pro
Kozuka Gothic Pro
Kozuka Gothic Pro
Kozuka Gothic Pro
Kozuka Gothic Pro
Kozuka Gothic Pro
Kozuka Gothic Pro
Kozuka Gothic Pro
Kozuka Gothic Pro
Kozuka Mincho Pr6N
Kozuka Mincho Pr6N
Kozuka Mincho Pr6N
Kozuka Mincho Pr6N
Kozuka Mincho Pr6N
Kozuka Mincho Pr6N
Kozuka Mincho Pr6N
Kozuka Mincho Pr6N
Kozuka Mincho Pr6N
Kozuka Mincho Pr6N
Kozuka Mincho Pr6N
Kozuka Mincho Pr6N
Kozuka Mincho Pro
Kozuka Mincho Pro
Kozuka Mincho Pro
Kozuka Mincho Pro
Kozuka Mincho Pro
Kozuka Mincho Pro
Kozuka Mincho Pro
Kozuka Mincho Pro
Kozuka Mincho Pro
Kozuka Mincho Pro
Kozuka Mincho Pro
Kozuka Mincho Pro
La Bamba LET
La Bamba LET
Leelawadee UI
Leelawadee UI
Leelawadee UI
Leelawadee UI
Leelawadee UI
Leelawadee UI
Letter Gothic Std
Letter Gothic Std
Letter Gothic Std
Letter Gothic Std
Letter Gothic Std
Letter Gothic Std
Letter Gothic Std
Letter Gothic Std
Lithos Pro
Lithos Pro
Lithos Pro
Lithos Pro
Lucida Console
Lucida Console
Lucida Sans Unicode
Lucida Sans Unicode
MS Gothic
MS Gothic
MT Extra
MV Boli
MV Boli
Malgun Gothic
Malgun Gothic
Malgun Gothic
Malgun Gothic
Malgun Gothic
Malgun Gothic
Marlett
Mekanik LET
Mekanik LET
Mesquite Std
Mesquite Std
Microsoft Himalaya
Microsoft Himalaya
Microsoft JhengHei
Microsoft JhengHei
Microsoft JhengHei
Microsoft JhengHei
Microsoft JhengHei
Microsoft JhengHei
Microsoft New Tai Lue
Microsoft New Tai Lue
Microsoft New Tai Lue
Microsoft New Tai Lue
Microsoft PhagsPa
Microsoft PhagsPa
Microsoft PhagsPa
Microsoft PhagsPa
Microsoft Sans Serif
Microsoft Sans Serif
Microsoft Tai Le
Microsoft Tai Le
Microsoft Tai Le
Microsoft Tai Le
Microsoft YaHei
Microsoft YaHei
Microsoft YaHei
Microsoft YaHei
Microsoft YaHei
Microsoft YaHei
Microsoft Yi Baiti
Microsoft Yi Baiti
Milano LET
Milano LET
MingLiU-ExtB
MingLiU-ExtB
Minion Pro
Minion Pro
Minion Pro
Minion Pro
Minion Pro
Minion Pro
Minion Pro
Minion Pro
Minion Pro
Minion Pro
Minion Pro
Minion Pro
Minion Pro
Minion Pro
Minion Pro
Minion Pro
Minion Pro
Minion Pro
Minion Pro
Minion Pro
MisterEarl BT
MisterEarl BT
Mongolian Baiti
Mongolian Baiti
Myanmar Text
Myanmar Text
Myanmar Text
Myanmar Text
Myriad Arabic
Myriad Arabic
Myriad Arabic
Myriad Arabic
Myriad Arabic
Myriad Arabic
Myriad Arabic
Myriad Arabic
Myriad Hebrew
Myriad Hebrew
Myriad Hebrew
Myriad Hebrew
Myriad Hebrew
Myriad Hebrew
Myriad Hebrew
Myriad Hebrew
Myriad Pro
Myriad Pro
Myriad Pro
Myriad Pro
Myriad Pro
Myriad Pro
Myriad Pro
Myriad Pro
Myriad Pro
Myriad Pro
Myriad Pro
Myriad Pro
Myriad Pro
Myriad Pro
Myriad Pro
Myriad Pro
Myriad Pro
Myriad Pro
Myriad Pro
Myriad Pro
Nirmala UI
Nirmala UI
Nirmala UI
Nirmala UI
Nirmala UI
Nirmala UI
Nueva Std
Nueva Std
Nueva Std
Nueva Std
Nueva Std
Nueva Std
Nueva Std
Nueva Std
Nueva Std
Nueva Std
Nueva Std
Nueva Std
OCR A Std
OCR A Std
Odessa LET
Odessa LET
OldDreadfulNo7 BT
OldDreadfulNo7 BT
One Stroke Script LET
One Stroke Script LET
Orange LET
Orange LET
Orator Std
Orator Std
Orator Std
Orator Std
Palatino Linotype
Palatino Linotype
Palatino Linotype
Palatino Linotype
Palatino Linotype
Palatino Linotype
Palatino Linotype
Palatino Linotype
ParkAvenue BT
ParkAvenue BT
Poplar Std
Poplar Std
Prestige Elite Std
Prestige Elite Std
Pump Demi Bold LET
Pump Demi Bold LET
Quixley LET
Quixley LET
Rage Italic LET
Rage Italic LET
Rosewood Std
Rosewood Std
Ruach LET
Ruach LET
STCaiyun
STIXGeneral
STIXGeneral
STIXGeneral
STIXGeneral
STIXNonUnicode
STIXNonUnicode
STIXNonUnicode
STIXNonUnicode
STIXSizeFiveSym
STIXSizeFourSym
STIXSizeFourSym
STIXSizeOneSym
STIXSizeOneSym
STIXSizeThreeSym
STIXSizeThreeSym
STIXSizeTwoSym
STIXSizeTwoSym
Scruff LET
Scruff LET
Segoe MDL2 Assets
Segoe MDL2 Assets
Segoe Print
Segoe Print
Segoe Print
Segoe Print
Segoe Script
Segoe Script
Segoe Script
Segoe Script
Segoe UI
Segoe UI
Segoe UI
Segoe UI
Segoe UI
Segoe UI
Segoe UI
Segoe UI
Segoe UI
Segoe UI
Segoe UI
Segoe UI
Segoe UI
Segoe UI
Segoe UI
Segoe UI
Segoe UI
Segoe UI
Segoe UI
Segoe UI
Segoe UI
Segoe UI
Segoe UI
Segoe UI
Segoe UI Emoji
Segoe UI Emoji
Segoe UI Historic
Segoe UI Historic
Segoe UI Symbol
Segoe UI Symbol
SimHei
SimHei
SimSun
SimSun
SimSun-ExtB
SimSun-ExtB
Sitka Small
Sitka Small
Sitka Small
Sitka Small
Sitka Small
Sitka Small
Sitka Small
Sitka Small
Smudger LET
Smudger LET
Square721 BT
Square721 BT
Staccato222 BT
Staccato222 BT
Stencil Std
Stencil Std
Sylfaen
Sylfaen
Symbol
Symbol
Tahoma
Tahoma
Tahoma
Tahoma
Tekton Pro
Tekton Pro
Tekton Pro
Tekton Pro
Tekton Pro
Tekton Pro
Tekton Pro
Tekton Pro
Times New Roman
Times New Roman
Times New Roman
Times New Roman
Times New Roman
Times New Roman
Times New Roman
Times New Roman
Tiranti Solid LET
Tiranti Solid LET
Trajan Pro
Trajan Pro
Trajan Pro
Trajan Pro
Trebuchet MS
Trebuchet MS
Trebuchet MS
Trebuchet MS
Trebuchet MS
Trebuchet MS
Trebuchet MS
Trebuchet MS
University Roman LET
University Roman LET
Verdana
Verdana
Verdana
Verdana
Verdana
Verdana
Verdana
Verdana
Victorian LET
Victorian LET
Webdings
Webdings
Westwood LET
Westwood LET
Wingdings
Wingdings
Yu Gothic
Yu Gothic
Yu Gothic
Yu Gothic
Yu Gothic
Yu Gothic
Yu Gothic
Yu Gothic
cmb10
cmex10
cmmi10
cmr10
cmss10
cmsy10
cmtt10
"""
设置默认字体
查看到了所有的字体格式,我们也可以设置使用自己喜欢的字体格式。
方法1:
import numpy as np
import matplotlib.pyplot as pltplt.rcParams['font.sans-serif'][0] = 'Lucida Grande'
方法2
import numpy as np
import matplotlib.pyplot as pltplt.rcParams['font.sans-serif'] = ['Lucida Grande', 'Tahoma', 'DejaVu Sans', 'Verdana']
当然也可以先设置字体系列,再设置字体系列中字体的顺序,将想要的字体放置在第一个位置
import numpy as np
import matplotlib.pyplot as pltplt.rcParams['font.family'] = 'sans-serif' # 默认字体系列,因此该行可以省略
plt.rcParams['font.sans-serif'] = ['Lucida Grande', 'Tahoma', 'DejaVu Sans', 'Verdana']
如果大家觉得有用,就点个赞让更多的人看到吧~
相关文章:
matplotlib 的默认字体和默认字体系列
matplotlib 的默认字体和默认字体系列 查看默认字体和默认字体系列查看默认字体系列下包含的字体查看 plt.rcParams 设置的所有参数查看所有支持的字体格式设置默认字体方法1:方法2 今天给大家介绍一下 matplotlib 包中的默认字体以及默认字体系列。 查看默认字体和…...

STMCUBEMX_IIC_DMA_AT24C64读取和写入
STMCUBEMX_IIC_DMA_AT24C64读取和写入 说明: 1、此例程只是从硬件IIC升级到DMA读写,因为暂时存储的掉电不丢失数据不多,一页就可以够用,不用担心跨页读写的问题 2、使用DMA后,程序确实是变快了,但是也要注意…...
wsl2相关问题
磁盘空间 wsl 删除相关文件后,如删除docker 无用的容器和镜像,windows上磁盘仍然无法自动回收空间 (参考:[microsoft/WSL](https://github.com/microsoft/WSL/issues/4699#issuecomment-627133168)) # 如清除无用do…...
使用idea时,光标变成了不能按空格键,只能修改的vim格式,怎么切换回正常光标
情况1 你可能不小心启用了 IntelliJ IDEA 中的 Vim 插件。你可以尝试以下步骤来禁用它: 在 IntelliJ IDEA 中,选择 "File" -> "Settings" (如果你在 macOS 上,选择 "IntelliJ IDEA" -> &quo…...

vue+antd——实现table表格的打印——分页换行,每页都有表头——基础积累
这里写目录标题 场景效果图功能实现1:html代码功能实现2:css样式功能实现3:js代码补充内容page-break-inside 属性page-break-after属性page-break-before 属性 场景 最近在写后台管理系统时,遇到一个需求,就是要实现…...
linux C MD5计算
#include <stdio.h> #include <string.h> #include <openssl/md5.h>int main() {char str[] "Hello, world!"; // 需要计算MD5哈希值的字符串unsigned char digest[MD5_DIGEST_LENGTH]; // 存储MD5哈希值的数组MD5((unsigned char*)&str, str…...

vue3学习源码笔记(小白入门系列)------ 组件更新流程
目录 说明例子processComponentcomponentUpdateFnupdateComponentupdateComponentPreRender 总结 说明 由于响应式相关内容太多,决定先接着上文组件挂载后,继续分析组件后续更新流程,先不分析组件是如何分析的。 例子 将这个 用例 使用 vi…...

数学建模B多波束测线问题B
数学建模多波束测线问题 1.问题重述: 单波束测深是一种利用声波在水中传播的技术来测量水深的方法。它通过测量从船上发送声波到声波返回所用的时间来计算水深。然而,由于它是在单一点上连续测量的,因此数据在航迹上非常密集,但…...
Pytest 框架执行用例流程浅谈
背景: 根据以下简单的代码示例,我们将从源码的角度分析其中的关键加载执行步骤,对pytest整体流程架构有个初步学习。 代码示例: import pytest def test_add(): assert 1 1 2 def test_sub(): assert 2 - 1 1 通过 pytes…...

C#__资源访问冲突和死锁问题
/// 线程的资源访问冲突:多个线程同时申请一个资源,造成读写错乱。 /// 解决方案:上锁,lock{执行的程序段}:同一时刻,只允许一个线程访问该程序段。 /// 死锁问题: /// 程序中的锁过多…...

机器学习——Logistic Regression
0、前言: Logistic回归是解决分类问题的一种重要的机器学习算法模型 1、基本原理: Logistic Regression 首先是针对二分类任务提出的一种分类方法如果将概率看成一个数值属性,则二元分类问题的概率预测就可以转化为一个回归问题。这种思路最…...
创建husky规范前端项目
创建husky规范前端项目 .husky文件是一个配置文件,用于配置Git钩子。Git钩子是在Git操作时触发的脚本,可以用于自动化一些任务,比如代码格式化、代码检查、测试等。.husky文件可以指定在Git的不同操作(如commit、push等ÿ…...

深浅拷贝与赋值
数据类型 数据类型 在JavaScript中,数据类型有两大类。一类是基本数据类型,一类是引用数据类型。 基本数据类型有六种:number、string、boolean、null、undefined、symbol。 基本数据类型存放在栈中。存放在栈中的数据具有数据大小确定&a…...
bert ranking pairwise demo
下面是用bert 训练pairwise rank 的 demo import torch from torch.utils.data import DataLoader, Dataset from transformers import BertModel, BertTokenizer from sklearn.metrics import pairwise_distances_argmin_minclass PairwiseRankingDataset(Dataset):def __ini…...

GPT引领前沿与应用突破之GPT4科研实践技术与AI绘图
GPT对于每个科研人员已经成为不可或缺的辅助工具,不同的研究领域和项目具有不同的需求。例如在科研编程、绘图领域:1、编程建议和示例代码: 无论你使用的编程语言是Python、R、MATLAB还是其他语言,都可以为你提供相关的代码示例。2、数据可视…...

SpringBoot整合Swagger3
前言 swagger是啥,是干什么的,有什么用,我想在这里我就不用介绍了,下面直接代码演示。 添加依赖 <?xml version"1.0" encoding"UTF-8"?> <project xmlns"http://maven.apache.org/POM/4.0.0…...
detectron2 install path
>>> import detectron2 >>> detectron2_path detectron2.__file__ >>> print(detectron2.__file__)...

如何将DHTMLX Suite集成到Scheduler Lightbox中?让项目管理更可控!
在构建JavaScript调度器时,通常需要为最终用户提供一个他们喜欢的方式来计划事件,这是Web开发人员喜欢认可DHTMLX Scheduler的重要原因,它在这方面提供了完全的操作自由,它带有lightbox弹出窗口,允许通过各种控件动态更…...

什么是JVM常用调优策略?分别有哪些?
目录 一、JVM调优 二、堆内存大小调整 三、垃圾回收器调优 四、线程池调优 一、JVM调优 Java虚拟机(JVM)的调优主要是为了提高应用程序的性能,包括提高应用程序的响应速度和吞吐量。以下是一些常用的JVM调优策略: 堆内存大小…...

《向量数据库指南》——向量数据库Milvus Cloud 2.3的可运维性:从理论到实践
一、引言 在数据科学的大家庭中,向量数据库扮演着重要角色。它们通过独特的向量运算机制,为复杂的机器学习任务提供了高效的数据处理能力。然而,如何让这些数据库在生产环境中稳定运行,成为了运维团队的重要挑战。本文将深入探讨向量数据库的可运维性,并分享一些有趣的案…...
【杂谈】-递归进化:人工智能的自我改进与监管挑战
递归进化:人工智能的自我改进与监管挑战 文章目录 递归进化:人工智能的自我改进与监管挑战1、自我改进型人工智能的崛起2、人工智能如何挑战人类监管?3、确保人工智能受控的策略4、人类在人工智能发展中的角色5、平衡自主性与控制力6、总结与…...

阿里云ACP云计算备考笔记 (5)——弹性伸缩
目录 第一章 概述 第二章 弹性伸缩简介 1、弹性伸缩 2、垂直伸缩 3、优势 4、应用场景 ① 无规律的业务量波动 ② 有规律的业务量波动 ③ 无明显业务量波动 ④ 混合型业务 ⑤ 消息通知 ⑥ 生命周期挂钩 ⑦ 自定义方式 ⑧ 滚的升级 5、使用限制 第三章 主要定义 …...
《Playwright:微软的自动化测试工具详解》
Playwright 简介:声明内容来自网络,将内容拼接整理出来的文档 Playwright 是微软开发的自动化测试工具,支持 Chrome、Firefox、Safari 等主流浏览器,提供多语言 API(Python、JavaScript、Java、.NET)。它的特点包括&a…...

【机器视觉】单目测距——运动结构恢复
ps:图是随便找的,为了凑个封面 前言 在前面对光流法进行进一步改进,希望将2D光流推广至3D场景流时,发现2D转3D过程中存在尺度歧义问题,需要补全摄像头拍摄图像中缺失的深度信息,否则解空间不收敛…...
【算法训练营Day07】字符串part1
文章目录 反转字符串反转字符串II替换数字 反转字符串 题目链接:344. 反转字符串 双指针法,两个指针的元素直接调转即可 class Solution {public void reverseString(char[] s) {int head 0;int end s.length - 1;while(head < end) {char temp …...

MySQL 8.0 OCP 英文题库解析(十三)
Oracle 为庆祝 MySQL 30 周年,截止到 2025.07.31 之前。所有人均可以免费考取原价245美元的MySQL OCP 认证。 从今天开始,将英文题库免费公布出来,并进行解析,帮助大家在一个月之内轻松通过OCP认证。 本期公布试题111~120 试题1…...

初学 pytest 记录
安装 pip install pytest用例可以是函数也可以是类中的方法 def test_func():print()class TestAdd: # def __init__(self): 在 pytest 中不可以使用__init__方法 # self.cc 12345 pytest.mark.api def test_str(self):res add(1, 2)assert res 12def test_int(self):r…...
在web-view 加载的本地及远程HTML中调用uniapp的API及网页和vue页面是如何通讯的?
uni-app 中 Web-view 与 Vue 页面的通讯机制详解 一、Web-view 简介 Web-view 是 uni-app 提供的一个重要组件,用于在原生应用中加载 HTML 页面: 支持加载本地 HTML 文件支持加载远程 HTML 页面实现 Web 与原生的双向通讯可用于嵌入第三方网页或 H5 应…...
虚拟电厂发展三大趋势:市场化、技术主导、车网互联
市场化:从政策驱动到多元盈利 政策全面赋能 2025年4月,国家发改委、能源局发布《关于加快推进虚拟电厂发展的指导意见》,首次明确虚拟电厂为“独立市场主体”,提出硬性目标:2027年全国调节能力≥2000万千瓦࿰…...
JavaScript 数据类型详解
JavaScript 数据类型详解 JavaScript 数据类型分为 原始类型(Primitive) 和 对象类型(Object) 两大类,共 8 种(ES11): 一、原始类型(7种) 1. undefined 定…...