python绘图问题
论文绘图整理
# coding: utf-8
#来源:https://blog.csdn.net/A_Z666666/article/details/81165123
import matplotlib.pyplot as plt
# figsize = 11, 9
# figure, ax = plt.subplots(figsize = figsize)
x1 =[0,5000,10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000, 55000]
y1=[0, 223, 488, 673, 870, 1027, 1193, 1407, 1609, 1791, 2113, 2388]
x2 = [0, 5000, 10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000, 55000]
y2 = [0, 214, 445, 627, 800, 956, 1090, 1281, 1489, 1625, 1896, 2151]
# 设置输出的图片大小
figsize = 11, 9
figure, ax = plt.subplots(figsize=figsize)
# 在同一幅图片上画两条折线
A, = plt.plot(x1, y1, '-r', label='A', linewidth=5.0)
B, = plt.plot(x2, y2, 'b-.', label='B', linewidth=5.0)
# 设置图例并且设置图例的字体及大小
font1 = {'family': 'Times New Roman',
'weight': 'normal',
'size': 23,
}
legend = plt.legend(handles=[A, B], prop=font1)
# 设置坐标刻度值的大小以及刻度值的字体
plt.tick_params(labelsize=23)
labels = ax.get_xticklabels() + ax.get_yticklabels()
# print labels
[label.set_fontname('Times New Roman') for label in labels]
# 设置横纵坐标的名称以及对应字体格式
font2 = {'family': 'Times New Roman',
'weight': 'normal',
'size': 30,
}
plt.xlabel('round', font2)
plt.ylabel('value', font2)
plt.show()
、、、、、、、、、、、、、、、、、
关于图片的长宽比设定
plt.figure(figsize=[16,8]) #这个是图片的长宽比。
、、、、、、、、、、、、、、、、
关于坐标调整
、、、、、、、、、、、、、、、、
import matplotlib.pyplot as plt
x1 = [1, 2, 3]
y1 = [1, 4, 9]
x2 = [1, 2, 3]
y2 = [5, 6, 7]
plt.plot(x1, y1, label='y=x*x')
plt.plot(x2, y2, label='y=x+4')
plt.xlabel('input number')
plt.ylabel('ouput number')
plt.title('测试某些函数')
plt.legend()
plt.show()
---------------------
作者:xjl271314
来源:CSDN
原文:https://blog.csdn.net/xjl271314/article/details/80291284
版权声明:本文为博主原创文章,转载请附上博文链接!
、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、
关于图例的设置
https://blog.csdn.net/u012735708/article/details/82114565 里面有很好的信息。
plt.legend(bbox_to_anchor=(1., 1.02, 1., .102),ncol=6,loc=1,prop=font1) # 让图例生效 【这个应当添加上内容才是,】ncol代表了图例的列数
https://blog.csdn.net/u010358304/article/details/78906768#在同一幅图片上画两条折线
A,=plt.plot(x1,y1,'-r',label='A',linewidth=5.0)
B,=plt.plot(x2,y2,'b-.',label='B',linewidth=5.0)
#设置图例并且设置图例的字体及大小
font1 = {'family' : 'Times New Roman',
'weight' : 'normal',
'size' : 23,
}
legend = plt.legend(handles=[A,B],prop=font1)
---------------------
作者:CAM-TAY
来源:CSDN
原文:https://blog.csdn.net/u010358304/article/details/78906768
版权声明:本文为博主原创文章
、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、
http://www.cnblogs.com/awishfullyway/p/6124668.html 问题汇总
最新文章
- LeetCode() Basic Calculator 不知道哪里错了
- RESTful 接口规范
- ecshop退出登录会清空购物车的bug优化,最完美解决方法
- C#编程
- 将Mat类型转换成QImage类型
- AjaxPro框架
- android EditText中的inputType
- lucene 使用教程
- 日志管理-NLog日志框架简写用法
- Nlog的简单使用
- H5学习第三周
- python待学习内容
- 十二 logging模块
- [转]C++11 随机数学习
- k-means学习笔记
- 思考卷积神经网络(CNN)中各种意义
- html页面中event的常见应用
- MySQL锁之二:锁相关的配置参数
- 线程的run( ) 和 start( ) 区别
- jquery easy ui 的formatter 格式化函数代码
热门文章
- POJ 1611 The Suspects 并查集 Union Find
- .vscode folder
- css3中rem和em是干嘛的
- 控制器不存在:app\admin\controller\Document
- android的HTTP框架之Volley
- 51nod 最长公共子序列+输出路径
- tcp_tw_recycle检查tcp_timestamps的内核代码
- 设计模式实例(Lua)笔记之六(Adapter模式)
- swift 创建第一个UIAlertView 和UIActionSheet
- SQl 行转列,列转行 (PIVOT,UPIVOT)