当前位置: 首页 > news >正文

flash网站开发工具做百度企业网站有什么好处

flash网站开发工具,做百度企业网站有什么好处,甘肃建设监理协会网站,邢台优化公司一、前言: 使⽤matplotlib画图时,由于matplotlib默认没有中⽂,显⽰中文时会出现空⽩⼩⽅块。 二、方法: 2.1 matplotlib中使用SimHei字体 1)进入终端后查看matplotlib的字体路径: $ python >>&g…

一、前言:

使⽤matplotlib画图时,由于matplotlib默认没有中⽂,显⽰中文时会出现空⽩⼩⽅块。

二、方法:

2.1 matplotlib中使用SimHei字体

1)进入终端后查看matplotlib的字体路径:

$ python
>>> import matplotlib
>>> print(matplotlib.matplotlib_fname())

得到路径:/Users/dongjun/.local/lib/python3.7/site-packages/matplotlib/mpl-data/matplotlibrc

2)下载SimHei.ttf字体:

https://us-logger1.oss-cn-beijing.aliyuncs.com/SimHei.ttf

3)将下载好的SimHei.ttf字体移动到第⼀步查询到的字体⽬录./fonts/ttf/下:

cp SimHei.ttf /Users/dongjun/.local/lib/python3.7/site-packages/matplotlib/mpl-data/fonts/ttf/SimHei.ttf

4)清理matplotlib缓冲⽬录:

$ python
>>> import matplotlib
>>> print(matplotlib.get_cachedir())

得到缓冲目录为:/Users/dongjun/.matplotlib

$ rm -f /Users/dongjun/.matplotlib

5)修改matplotlib原始文件

vim /Users/dongjun/.local/lib/python3.7/site-packages/matplotlib/mpl-data/matplotlibrc

依次修改以下内容:

# 去掉前⾯的#
font.family:  sans-serif
# 去掉前⾯的#,⼿动加SimHei
font.sans-serif: SimHei, DejaVu Sans, Bitstream Vera Sans, Computer Modern Sans Serif, Lucida Grande, Verdana, Geneva, Lucid, Arial, Helvetica, Avant Garde, sans-serif
# 去掉前⾯的#,把True改为False
axes.unicode_minus: False  # use Unicode for the minus symbol rather than hyphen.

6)重启测试

在matplotlib中导入SimHei字体,重新画图即可。

import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif'] = ['SimHei'] 
plt.rcParams['axes.unicode_minus'] = False

 2.2  使用其他字体

import cv2
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inlineplt.rcParams['font.sans-serif']=['Songti SC'] #用来正常显示中文标签
# 或者是下面这个,宋体和仿宋字体,都可以用。
plt.rcParams['font.sans-serif']=['STFangsong'] #用来正常显示中文标签
plt.rcParams['axes.unicode_minus'] = False  # 用来正常显示负号

Windows与Mac通用

import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif']=['SimHei','Songti SC','STFangsong']
plt.rcParams['axes.unicode_minus'] = False  # 用来正常显示负号

示例: 

 
import matplotlib.pyplot as plt
import matplotlib#from matplotlib import font_manager
#plt.rcParams['font.sans-serif'] = ['Heiti TC']#plt.rcParams['font.sans-serif'] = ['Songti SC']#plt.rcParams['font.sans-serif'] = ['Arial Unicode MS']plt.rcParams['font.sans-serif'] = ['PingFang HK']# 创建数据
x = [1, 2, 3, 4, 5]
y1 = [2, 1, 9, 8, 10]
y2 = [100, 300, 500, 700, 900]# 创建图形和轴
fig, ax1 = plt.subplots()# 绘制左侧Y轴数据
ax1.plot(x, y1, 'b-')
ax1.set_xlabel('X轴')
ax1.set_ylabel('左侧Y轴', color='b')# 创建第二个Y轴
ax2 = ax1.twinx()# 绘制右侧Y轴数据
ax2.plot(x, y2, 'r--')
ax2.set_ylabel('右侧Y轴', color='r')# 显示图形
plt.show()

效果:

http://www.yayakq.cn/news/330154/

相关文章:

  • 建设外贸网站报价wordpress漂浮框
  • 建站软件免费模板深圳企业网站建设费用
  • 做荣誉证书的网站东莞网络做推广公司
  • 做微信推文的网站设计网站页面鉴赏技巧ppt
  • 东莞企业公司网站建设网站开发用什么软件有哪些
  • 房产网站建设产品无极在线网站播放
  • 思明区建设局网站设计师网站库
  • 广州做网站公司哪家好wordpress手动备份
  • 网站上截小屏幕 怎么做做吉祥物的网站
  • 大力推进网站集约化建设网站设计权限
  • 单位网站 单位网页 区别深圳证券网站开发
  • 自己动手获取网站访客qq号码淘宝关键词推广
  • 网站没有百度权重《jsp网站开发详解》百度云
  • 外国网站上做Task免费制作网站服务器
  • 资源类网站怎么做的深圳十大广告公司
  • 网站广告设计怎么做商机加盟好项目
  • 网站建设实训报告心得如何使用模板做网站
  • 做音乐的网站网站建设工作领导小组
  • 企业网站模板演示上海最近新闻
  • 寻找大连网站建设北京网站建设公司哪个好
  • 云阳网站建设南京最新发布
  • 泰安做网站建设的公司哪家好wordpress 生成html
  • 网站的排名优化怎么做广东网站建设哪家专业
  • 中国制药网网站开发技术比较好的h5制作软件
  • 建设房地产公司网站的费用最有效的推广方式
  • 网站优化招聘化妆品网站 源码
  • 东昌府聊城网站优化公众号运营外包
  • 网站维护一般要几天二手房网站怎么做才能接到电话
  • 网站续费协议个人网站的制作教程
  • 如何在网站建设远程教育wordpress点击阅读全部