当前位置:网站首页>matplotlib中文问题
matplotlib中文问题
2022-07-29 00:39:00 【红目香薰】
是matplotlib库中没有中文字体。
那么,咱们安装上也就行了。
1、通过pip安装【anaconda】
pip3 install anaconda
2、加上设置
from matplotlib import pyplot as plt
plt.rcParams['font.sans-serif'] = ['SimHei'] # 用来正常显示中文标签
plt.rcParams['axes.unicode_minus'] = False # 用来正常显示负号Demo示例:
from matplotlib import pyplot as plt
import random
plt.rcParams['font.sans-serif'] = ['SimHei'] # 用来正常显示中文标签
plt.rcParams['axes.unicode_minus'] = False # 用来正常显示负号
# 异常气温变化值
# 0.准备x, y坐标的数据
x = range(100)
y_jiangsu = [random.randint(-50, 60) for i in x]
# 1.创建画布
plt.figure(figsize=(20, 8), dpi=80)
# 2.绘制折线图
plt.plot(x, y_jiangsu)
plt.title("异常温度变化表")
plt.xlabel("温度℃")
plt.ylabel("记录次数")
# 3.显示图像
plt.show()

边栏推荐
- APP接入Kakaotalk三方登录
- Groundwater, soil, geology and environment
- 新1688 API 接入说明
- 表达式求值
- Third party login process of flask Weibo
- Flink SQL Hudi actual combat
- 【SQL之降龙十八掌】01——亢龙有悔:入门10题
- Test / development programmers rely on technology to survive the midlife crisis? Improve your own value
- Openpyxl border
- C语言犄角旮旯的知识之形参、实参、main函数参数、数组或指针做函数参数等
猜你喜欢

SQL question brushing: find the last of all employees_ Name and first_ Name and corresponding department number Dept_ no

时间复杂度、空间复杂度的学习总结

nep 2022 cat

Self-attention neural architecture search for semantic image segmentation

Cloud native application comprehensive exercise

C语言300行代码实现扫雷(可展开+可标记+可更改困难级别)

【搜索】—— DFS之剪枝与优化

DVWA之SQL注入

Oozie工作调度

Flink SQL Hudi actual combat
随机推荐
uniapp createSelectorQuery(). Select get returns null error
时间复杂度、空间复杂度的学习总结
跨模态对齐 20220728
Date conversion EEE MMM DD hh:mm:ss zzz YYYY
Textkit custom uilabel identification link
代码生成器
[idea] where to use the query field
Groundwater, soil, geology and environment
Pinduoduo can use many API interfaces
Understand various paths
(perfect solution) why is the effect of using train mode on the train/val/test dataset good, but it is all very poor in Eval mode
(update 20211130) about the download and installation of Jupiter notebook and its own configuration and theme
vm options、program arguments、environment property
如何选择专业、安全、高性能的远程控制软件
Flink Postgres CDC
Read the recent trends of okaleido tiger and tap the value and potential behind it
【搜索】—— DFS之剪枝与优化
Use of resttemplate and Eureka
Cloud native application comprehensive exercise
Redis is installed on Linux