背景:

  • win10, anaconda 4.8.3, python3.8.3
  • matplotlib画图, 小程序运行时,图像中坐标轴“负号”显示不全,(我这里)表现为“方框”,图片见下面。
  • 关闭图像后, 有的情况下会有Glyph8722 warning提示,有的没有。

办法

  • 这里的错误提示,只给出Glyph 8722 missing from current font …,不容易联系到和坐标轴的负号显示相关。比如下面代码段中#subplot(233) 这个图的代码画图后,会有这个提示。
  • 有的情况下,负号显示不正常,但是没有warning 给出。这种情况下,目标比较明确,较为容易。比如代码中,屏蔽了#subplot(233) 这个图的代码段后,就是这种情况。
  • 两种情况下,都可以通过更改 axes.unicode_minus 更正。
  • plt.rcParams[‘axes.unicode_minus’]=False, 或 mpl.rcParams[‘axes.unicode_minus’]=False
  • plt 为 matplotlib.pyplot 的简写;
  • mpl 为 matplotlib的简写。
  • 例子见下面。

图片和例子

#
#多个统计图的组合
#
#import matplotlib.pyplot as plt
import numpy as npfig,ax=plt.subplots(2,3)#plt.rcParams['axes.unicode_minus']=False#subplot(231)
colors=["#8dd3c7","#ffffb3", "#bebada"]
ax[0,0].bar([1,2,3],[0.6, 0.2,0.8], color=colors, width=0.5, hatch='///', align='center')
ax[0,0].errorbar([1,2,3],[0.6,0.2,0.8], yerr=0.1, capsize=0, ecolor="#377eb8", fmt='o:')
ax[0,0].set_ylim(0,1.0)#subplot(232)
ax[0,1].errorbar([1,2,3],[20,30,36],xerr=2,ecolor="#4daf4a", elinewidth=2, fmt='s', label='ETN')
ax[0,1].legend(loc=3, fancybox=True,shadow=True, fontsize=10,borderaxespad=0.4)
ax[0,1].set_ylim(10,40)
ax[0,1].set_xlim(-2,6)
ax[0,2].grid(ls=":", lw=1,color='grey', alpha=0.5)#subplot(233)
x3=np.arange(1,10,0.5)
y3=np.cos(x3)
ax[0,2].stem(x3,y3,basefmt='r-',linefmt='b-', markerfmt='bo',label='liftesignal', use_line_collection=True)
ax[0,2].legend(loc=2,fontsize=8,frameon=False,borderpad=0.0,borderaxespad=0.6)
ax[0,2].set_xlim(0,11)
ax[0,2].set_ylim(-1.1, 1.1)plt.show()

Glyph 8722 missing from current font, matplotlib画图相关推荐

  1. RuntimeWarning: Glyph 30452 missing from current font. matplotlib画图无法显示中文

    matplotlib画图无法显示中文 RuntimeWarning: Glyph 30452 missing from current font. plt画图的title显示的中文是方括号 错误图: ...

  2. Matplotlib绘图显示缺少中文字体-RuntimeWarning: Glyph 8722 missing from current font.

    pyplot 并不默认支持中文显示,也没有自带中文字体,因此需要自行下载所需字体,并修改 rcParams 参数来显示中文.下面以 SimHei (黑体)字体为例进行说明. 说明:系统环境为 Linu ...

  3. Glyph 26426 missing from current font. matplotlib显示中文乱码解决

    网上关于这个问题的帖子也不少,但按照他们的方法尝试后,仍然解决不了我的问题.痛定思痛,花了一天时间看了不少matplotlib底层源码,终于把这个问题解决了.后来发现网上的很多方法真的是"多 ...

  4. RuntimeWarning: Glyph 8722 missing from current font. font.set_text(s, 0.0, flags=flags)

    利用matplotlib绘图时负号不显示,且报错8722 解决办法: plt.rcParams['axes.unicode_minus']=False #用来正常显示负号

  5. Glyph 26426 missing from current font.解决matplotlib画图中文字体乱码问题

    1. 问题复现 环境:Ipython 3.8 import matplotlib.pyplot as plt import pandas as pddata = pd.read_csv('/Users ...

  6. python画图时,中文无法正常显示的问题,RuntimeWarning: Glyph 26631 missing from current font. font.set_text(s, 0, fl

    python画图时,中文无法正常显示的问题,RuntimeWarning: Glyph 26631 missing from current font. font.set_text(s, 0, fla ...

  7. matplotlib解决中文乱码问题,或者RuntimeWarning: Glyph 20154 missing from current font.

    matplotlib解决乱码问题 如图:为图表添加名称时报措,如何处理. 添加代码: from pylab import mplmpl.rcParams['font.sans-serif'] =[&q ...

  8. glyph 24230 missing from current font.解决-matplotlib绘图踩坑

    问题描述 用matplotlib绘图的时候,title是中文 报错如下: D:\Anaconda3\lib\site-packages\matplotlib\backends\backend_agg. ...

  9. python出现中文乱码 RuntimeWarning: Glyph 24180 missing from current font.解决方法

    文章目录 遇到的问题 解决方法 参考 解决方法:在画图前添加这样一句代码 plt.rcParams['font.sans-serif'] = ['SimHei'] 遇到的问题 环境:win10,编辑器 ...

最新文章

  1. 【查询】—Entity Framework实例详解
  2. Python使用@property方法改变方法为参数
  3. 如何设计一门语言(十)——正则表达式与领域特定语言(DSL)
  4. 北斗导航 | Select Satellite 选星算法
  5. 操作系统 | 用户态和内核态的切换(中断、系统调用与过程(库函数)调用)
  6. 桌面SVN检出这一选项消失
  7. JS修改标签中的文本且不影响其中标签
  8. js插入元素的新方法insertAdjacentHTML
  9. Cocos2d-x windows + vs2010 配置图文详解
  10. java+swing+教科书,java+Swing+学生事务管理系统
  11. 用PHP做服务器接口客户端用http协议POST访问安全性一般怎么做
  12. Android Service中的android:process=:remote
  13. 用Elasticsearch做大规模数据的多字段、多类型索引检索
  14. 团队作业9——展示博客
  15. 靠写iPhone程序发财的三个故事
  16. CDQZ多校集训题目--盛夏
  17. JVM内存不足增大运行时内存
  18. 使用python(matplotlib)打开图片
  19. 《乘风破浪的姐姐》的观后感,有钱真好!
  20. MySQL补充——索引,流程控制,数据备份,python操作mysql,SQLAlchemy

热门文章

  1. 加入键盘鼠标控制的代码
  2. Android 客户端起HttpServer NanoHttpd
  3. OSChina 儿童节乱弹 —— 六一不能让童工加班!
  4. 来自老程序员的10条中肯建议
  5. phpstudy-linux您修改了面板程序,这是不允许的 请进入服务器命令行输入xp查看修复方法 +解决方法
  6. C语言中图形函数及其用法
  7. Python 一维波动方程差分法求解及可视化
  8. 安卓系统能运行 linux,重磅!安卓系统竟能运行PC软件,实测效果令人惊在当场!...
  9. jQuery对Ajax的升级简化
  10. 三个月自学自动化测试,鬼知道我经历了什么?薪资从4.5K到11K