python绘图小记
来源:互联网 发布:golang和go的区别 编辑:程序博客网 时间:2024/05/10 17:18
# #!/usr/bin/env python# # -*- coding: UTF-8 -*-# """# @version: python2.7.8# @author: XiangguoSun# @contact: sunxiangguodut@qq.com# @file: 4.py# @time: 2017/2/16 11:07# @software: PyCharm# """import sysreload(sys)sys.setdefaultencoding('utf-8')import numpy as npimport matplotlib.pyplot as pltfrom mpl_toolkits.mplot3d.art3d import Poly3DCollectiondef randrange(n, vmin, vmax): return np.random.randint(vmin,vmax,n)def fun(ax,ben,color,n): zl, zh = (0, 100) x5 = randrange(n, 0, 100) y5 = randrange(n, 0, 100) z5=randrange(n,5,6) ax.scatter(x5, y5, z5,s=50,c=color,marker='o') poly3d = [[(0, 0, ben), (0, 100, ben), (100, 100, ben), (100, 0, ben)] ] ax.add_collection3d(Poly3DCollection(poly3d, facecolors=color, linewidths=1, alpha=0.2))fig = plt.figure()ax = fig.gca(projection='3d')fun(ax,5,"red",10)fun(ax,50,"green",15)fun(ax,90,"blue",10)n = 50color="yellow"zl, zh = ( 0, 100)xa = randrange(n, 0, 100)ya = randrange(n, 0, 100)za = randrange(n, zl, zh)ax.scatter(xa, ya, za,s=50,c=color,marker='o')ax.set_xlabel('$x^{(1)}$',size=20)#$x^{(1)}$是Latex表达式ax.set_xlim3d(0, 100)ax.set_ylabel('$x^{(2)}$',size=20)ax.set_ylim3d(0,100)ax.set_zlabel('$z$',size=20)ax.set_zlim3d(0,100)plt.show()
0 0
- python绘图小记
- MATLAB绘图参数汇总小记
- python 小记
- python小记
- python小记
- python 小记
- python 小记
- Python 小记
- Python小记
- Python绘图
- python绘图
- python绘图
- python绘图
- python绘图 初识Python绘图
- python绘图 初识Python绘图
- python绘图 初识Python绘图
- python绘图 初识Python绘图
- python绘图 初识Python绘图
- SQL2005 数据库 附加失败
- spring与RabbitMQ整合 消费者消费不到消息 重启才能消费到的问题解决
- 访问原理及HTTP协议
- html 盒子模型基础(单位,边框,内边距,外边距)(一)
- centos中忘记mysql密码
- python绘图小记
- ASP.NET Web Forms – 教程
- Android自定义控件实例(1)——自定义控件之组合控件,包含书签的pdf阅读器
- ES权威指南_04_aggs_03 Building Bar Charts(柱状、直方图)
- 设计模式解析之代理模式
- 设计模式
- 关于分页及增删改查
- ES权威指南_04_aggs_04 Looking at Time【date_histogram】
- PL/SQL出现中文乱码