python3 使用matplotlib画图问题
保存图片的问题
在画子图并保存图片的时候,用如下代码保存的图片总是不能显示,但是在运行的过程中能够正常显示图片。
# coding:utf-8
from pylab import *
# 创建子图
figure1 = subplot(2,1,1)
figure2 = subplot(2,1,2)
# 选择子图1
sca(figure1)
plot(x,func(x))
# 选择子图2
sca(figure2)
plot(x,func(x))
# show
show()
# save
savefig("test.svg")
解决
为什么呢???
原来,子图需要挨个儿保存
---
# 选择子图1
sca(figure1)
plot(x,func(x))
# caution
savefig("test.svg")
# 选择子图2
sca(figure2)
plot(x,func(x))
# caution
savefig("test.svg")
# show
show()
# save
#savefig("test.svg")
完美解决!
画布大小问题
这是一个很坑爹的事儿,坑爹完全在于 sublime text 的缩进功能,让原来本该早解决的问题变得尤其复杂。
问题是什么呢?
用savefig()
函数保存图片的时候,总是不能将图片放大了存。hin无奈啊。
怎么办呢?
#加这一句就好了
figure(figsize=(20, 20),dpi=80)
后记
安装matplotlib详见
教程见 Matplotlib 教程
python3 使用matplotlib画图问题的更多相关文章
- python3 使用matplotlib画图出现中文乱码的情况
python3使用matplotlib画图,因python3默认使用中unicode编码,所以在写代码时不再需要写 plt.xlabel(u’人数’),而是直接写plt.xlabel(‘人数’). 注 ...
- matplotlib画图出现乱码情况
python3使用matplotlib画图,因python3默认使用中unicode编码,所以在写代码时不再需要写 plt.xlabel(u’人数’),而是直接写plt.xlabel(‘人数’). 注 ...
- 解决Pycharm中matplotlib画图出错问题(AttributeError: module 'matplotlib' has no attribute 'verbose')
最近在Linux中使用pycharm过程中使用matplotlib无法画图,总是提示错误 /usr/bin/python3. /home/leo/PycharmProjects/untitled1/E ...
- matplotlib画图报错This figure includes Axes that are not compatible with tight_layout, so results might be incorrect.
之前用以下代码将实验结果用matplotlib show出来 plt.plot(np.arange(len(aver_reward_list)), aver_reward_list) plt.ylab ...
- python matplotlib画图产生的Type 3 fonts字体没有嵌入问题
ScholarOne's 对python matplotlib画图产生的Type 3 fonts字体不兼容,更改措施: 在程序中添加如下语句 import matplotlib matplotlib. ...
- centos7虚拟机下python3安装matplotlib遇到的一些问题
1.安装位置 centos7虚拟机+python3.6 2.问题 2.1如果是使用的python2版本可以使用如下方式, #yum search matplotlib 返回如下: 已加载插件:fast ...
- 使用python中的matplotlib 画图,show后关闭窗口,继续运行命令
使用python中的matplotlib 画图,show后关闭窗口,继续运行命令 在用python中的matplotlib 画图时,show()函数总是要放在最后,且它阻止命令继续往下运行,直到1.0 ...
- matplotlib 画图
matplotlib 画图 1. 画曲线图 Tompson = np.array([0, 0, 0, 0, 0.011, 0.051, 0.15, 0.251, 0.35, 0.44, 0 ...
- matplotlib画图
matplotlib画图 import numpy as np import matplotlib.pyplot as plt x1=[20,33,51,79,101,121,132,145,162, ...
随机推荐
- 建站有很多技术,如 HTML、HTML5、XHTML、CSS、SQL、JavaScript、PHP、http://ASP.NET、Web Services、浏览器脚本、服务器脚本等。它们的区别是什么?新手一点不懂,想理清所有这些技术之间的关系和应用范围。
先普及用户通过 浏览器 访问网页 的过程: 网页内容是通过服务器运算得出的结果,将结果(网页代码)传输给浏览器,网页代码再通过浏览器运算(计算.渲染),最终展示在用户的眼前的. 至此,我们知道了有2个 ...
- JSON and XML Serialization in ASP.NET Web API
https://docs.microsoft.com/en-us/aspnet/web-api/overview/formats-and-model-binding/json-and-xml-seri ...
- 通过Fiddler进行手机抓包
通过Fiddler进行手机抓包 通过Fiddler抓包工具,可以抓取手机的网络通信,但前提是手机和电脑处于同一局域网内(WI-FI或热点),然后进行以下设置: 用Fiddler对Android应用进行 ...
- 【转】asp.net 项目在 IE 11 下出现 “__doPostBack”未定义 的解决办法
最近我们运营的网站有用户反馈在 IE 11 下<asp:LinkButton> 点击出现 “__doPostBack”未定义”,经过一番google,终于知道了原因:ASP.NET 可能无 ...
- [spring]xml配置文件---节点解释
转载:https://blog.csdn.net/u012099568/article/details/51423837
- python判断指定路径是否存在
https://www.cnblogs.com/jhao/p/7243043.html
- C++(三十三) — 全局函数、成员函数的区别
区别: (1)全局函数的参数个数,比局部函数要多一个: (2)二者都可,返回元素.返回引用. class test { public: test(int a, int b) { this->a ...
- wireshark抓取mysql数据包
最近在学习搭建数据库服务,因为跟产品相关所以需要从流量中拿到mysql的数据包.然后就想着在本机搭建mysql数据库,然后连接,用wireshark抓就行了. MySQL搭建用的是XAMPP,想说XA ...
- 重新学习MySQL数据库4:Mysql索引实现原理
重新学习Mysql数据库4:Mysql索引实现原理 MySQL索引类型 (https://www.cnblogs.com/luyucheng/p/6289714.html) 一.简介 MySQL目前主 ...
- dva-loading使用方法
1. 下载dva-loading npm install dva-loading --save 2. 导入并使用dva-loading import createLoading from 'dva-l ...