简体   繁体   English

Matplotlib-等宽字体和FormatterWarning错误

[英]Matplotlib - error with monospace fonts and FormatterWarning

There hasn't been any change of the code that was working, but now I am getting this error, and I have no idea what to do about it: 尚未对正在运行的代码进行任何更改,但是现在我遇到了此错误,并且我不知道该如何处理:

/usr/lib64/python2.7/site-packages/matplotlib/font_manager.py:1224: UserWarning: findfont: Font family ['monospace'] not found. Falling back to Bitstream Vera Sans
  (prop.get_family(), self.defaultFamily[fontext]))
/usr/lib/python2.7/site-packages/IPython/core/formatters.py:239: FormatterWarning: Exception in image/png formatter: Locator attempting to generate 20001 ticks from 0.0 to 100.0: exceeds Locator.MAXTICKS
  FormatterWarning,

This line did the trick for me. 这条线对我有用。

sudo pacman -S dina-font

Here the web-page of the font. 这里是字体的网页。

http://www.donationcoder.com/Software/Jibz/Dina/index.html http://www.donationcoder.com/Software/Jibz/Dina/index.html

If you are not on Linux you will have to download and store the file in the appropriate folder. 如果您不在Linux上,则必须下载文件并将其存储在适当的文件夹中。 These are: 这些是:

#  OS Font paths
MSFolders = \
    r'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders'

MSFontDirectories   = [
    r'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts',
    r'SOFTWARE\Microsoft\Windows\CurrentVersion\Fonts']

X11FontDirectories  = [
    # an old standard installation point
    "/usr/X11R6/lib/X11/fonts/TTF/",
    "/usr/X11/lib/X11/fonts",
    # here is the new standard location for fonts
    "/usr/share/fonts/",
    # documented as a good place to install new fonts
    "/usr/local/share/fonts/",
    # common application, not really useful
    "/usr/lib/openoffice/share/fonts/truetype/",
    ]

OSXFontDirectories = [
    "/Library/Fonts/",
    "/Network/Library/Fonts/",
    "/System/Library/Fonts/",
    # fonts installed via MacPorts
    "/opt/local/share/fonts"
    ""
]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM