seaborn(matplotlib)画图,linux系统中文乱码等问题解决
data = pd.read_json(json.dumps(issue_dpl))
# set pic size
plt.figure(figsize=(13, 5))
sns.set_style('whitegrid', {'font.sans-serif': ['simhei', 'Arial']})
ax3 = sns.barplot(x=data['cls'], y=data['count'], data=data, ci=0)
ax3.set_title(u'问题分类统计')
ax3.set_xlabel(u'')
ax3.set_ylabel(u'')
plt.xticks(np.arange(len(cls_arr)) + 0.4 / 2, cls_arr, rotation=45)
sio = StringIO.StringIO()
savefig(sio, bbox_inches='tight', format='png')
savefig(‘test.png’, bbox_inches='tight', format='png') # tight强制显示全部,避免字体显示不全
plt.show()
cls count
0 不良质量 44
1 不正确校验 39
2 安全配置 32
3 信息泄露 24
4 权限控制 23
参考地址:https://www.cnblogs.com/gczr/p/6767175.html
https://blog.csdn.net/qq_34264472/article/details/53814653
linux Tkinter导入报以下错解决:
Type "help", "copyright", "credits" or "license" for more information.
>>> import Tkinter
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/python/lib/python2.7/lib-tk/Tkinter.py", line 39, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter
>>>
KeyboardInterrupt
>>>
先看原版本python是否可以导入,如果可以的话,直接跳过安装tk等包,否则先后安装tk-devel,python-tk, tcl, tcl-devel等包,然后重新编译安装python,解决
linux系统画图报错解决:(TclError: no display name and no $DISPLAY environment variable)
参考:https://blog.csdn.net/qq_22194315/article/details/77984423
linux中文乱码解决:
- 到 anaconda 的 matplotlib 中查看是否有 simhei.ttf 字体:
cd ~/anaconda3/lib/python3.5/site-packages/matplotlib/mpl-data/fonts/ttf
ls -al | grep simhei
- 如果没有,从 windows 中用 everything 搜索全局文件,找到 simhei.ttf,并将其上传到linux 的 matplotlib 的 fonts/ttf 文件夹
- 修改配置文件~/anaconda3/lib/python3.5/site-packages/matplotlib/mpl-data/matplotlibrc 文件,
-
font.family : sans-serif
font.sans-serif : simhei, Bitstream Vera Sans, Lucida Grande, Verdana, Geneva, Lucid, Arial, Helvetica, Avant Garde, sans-serif
-
- (linux)删除~/.cache/matplotlib/目录下的 fonts cache list,
rm -r ~/.cache/matplotlib
- 代码设置 matplotlib 和 seaborn 的环境
-
import matplotlib as mpl
# mpl.rcParams['font.sans-serif'] = ['simhei']
# mpl.rcParams['font.serif'] = ['simhei']
import seaborn as sns
sns.set_style("darkgrid",{"font.sans-serif":['simhei','Droid Sans Fallback']})
-
将该文件拷贝到.cache/matplotlib 目录下,并找到以下两行,改为如下:
- https://github.com/mwaskom/seaborn/issues/1009
- http://www.th7.cn/Program/Python/201704/1156781.shtml
- https://www.jianshu.com/p/b76481530472
seaborn(matplotlib)画图,linux系统中文乱码等问题解决的更多相关文章
- Linux oracle中文乱码的问题解决
乱码问题的根源是字符集的修改 1.查看linux的默认语言 2.查看客户端的语言编码设置 配置文件中的配置: cat ~/.bash_profile 注意修改配置信息: export PATHexp ...
- 本地文件程序脚本上传linux系统中文乱码问题
# 使用notepad++ 编辑器打开,转换一下格式保存,然后上传即可
- 解决Ubuntu系统中文乱码显示问题,终端打开文件及查看目录
解决Ubuntu系统中文乱码显示问题 [日期:2014-02-20] 来源:Linux社区 作者:njchenyi [字体:大 中 小] 我是先安装了Ubuntu 12.04 Server,然后 ...
- Linux系统中文显示
# Linux系统中文显示 ### 配置文件路径------------------------------ 路径`/etc/locate.conf` ### 查看系统当前字符集----------- ...
- Linux改中文乱码显示
Linux改中文乱码显示 可以使用locale命令,查看当前系统默认采用的字符集# locale在RedHat/CentOS系统下,记录系统默认使用语言的文件是/etc/ ...
- Linux下中文乱码
Linux下中文乱码 修改mysql配置文件,centeros下 配置文件在 /etc/my.cnf vi /etc/my.cnf 在[mysqld]段下添加 character-set-server ...
- Xshell4连接,Linux系统中文显示乱码解决办法
Xshell 是一个强大的安全终端模拟软件,它支持SSH1, SSH2, 以及Microsoft Windows 平台的TELNET NetSarang Xshell 4 Build 0120议.使用 ...
- linux之添加切换用户、系统变量、selinux、防火墙、系统中文乱码的讲解
######linux用户分类1.root 用户 linux皇帝 2.普通用户 贫民百姓 [root@oldboyedu-01 oldboy]# useradd oldboy[root@oldboye ...
- Python画图matplotlib展示图中中文乱码
在用python的 matplotlib 画图的时候,在图表上面有中文乱码问题,如下的: 解决过程: 平台:windows,python2.7步骤一:打开设置文件 import matplotlib ...
随机推荐
- 打包Cocos2d-xproject为PC项目
<1>第一步,得到总体的大.exe 1.复制cocos2d-x-2.2文件下的Release.win32文件侠到桌面. 2.将项目下的Resources里的资源拷贝到Release.win ...
- GroupCoordinator joingroup源码解析
转发请注明原创地址 http://www.cnblogs.com/dongxiao-yang/p/7463693.html kafka新版consumer所有的group管理工作在服务端都由Group ...
- 141. Linked List Cycle【easy】
141. Linked List Cycle[easy] Given a linked list, determine if it has a cycle in it. Follow up:Can y ...
- springboot解决第三方依赖jar包的问题
公司现在用的是springboot+maven,想要把一些老的项目都改成这种框架.但是一些老的项目中有好多第三方的jar包或者是自己的jar包,maven库上没有.最初的解决方案是一个个的deploy ...
- python第四周迭代器生成器序列化面向过程递归
第一节装饰器复习和知识储备------------ 第一节装饰器复习和知识储备------------ def wrapper(*args,**kwargs): index(*args,**kwa ...
- Power Network - poj 1459 (最大流 Edmonds-Karp算法)
Time Limit: 2000MS Memory Limit: 32768K Total Submissions: 24788 Accepted: 12922 Description A ...
- 获取jsapi_ticket
String accessTokenUrl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&a ...
- 我的第五个程序 java的JDBC连接mysql数据库 实现输入查询
import java.sql.*; import java.util.Scanner; public class JDBCTest { public static void main(String[ ...
- OpenCV中Kinect的使用(2)
接OpenCV中Kinect的使用(1),主要讲述OpenCV中关于Kinect接口(类 VideoCapture )的一些使用介绍. 类 VideoCapture 支持Kinect传感器.使用 Vi ...
- Spring MVC配置静态资源和资源包教程
1- 介绍 这篇教程文章是基于: Spring 4 MVC 2- 创建一个项目 File/New/Other.. 输入: Group ID: com.yiibai Artifact ID: Sprin ...