简介

  • mpl_toolkits.mplot3d是Matplotlib里面专门用来画三维图的工具包,官方指南请点击此处《mplot3d tutorial》

使用

导入
  • 使用from mpl_toolkits.mplot3d import *或者import mpl_toolkits.mplot3d as p3d
画图
  • 有两种方式
fig = plt.figure()
ax = p3d.Axes3D(fig)

或者

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
  • 画三维图需要先得到一个Axes3D对象,上面两种方式得到的ax都是Axes3D对象,接下来就可以调用函数在ax上画图了。如下(IPython):
In [1]: %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import mpl_toolkits.mplot3d as p3d fig = plt.figure()
ax = p3d.Axes3D(fig) z = np.linspace(0, 15, 1000)
x = np.sin(z)
y = np.cos(z)
ax.plot(x, y, z, 'green')

效果如下:

作者:ACphart
链接:https://www.jianshu.com/p/b563920fa7a8
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

Matplotlib:mpl_toolkits.mplot3d工具包的更多相关文章

  1. python的meshgrid用法和3D库 mpl_toolkits.mplot3d 与PolynomialFeatures多项式库学习

    meshgrid import numpy as np from matplotlib import pyplot as plt from mpl_toolkits.mplot3d import Ax ...

  2. Matplotlib学习---用mplot3d画莫比乌斯环(Mobius strip)

    mplot3d是matplotlib里用于绘制3D图形的一个模块.关于mplot3d 绘图模块的介绍请见:https://blog.csdn.net/dahunihao/article/details ...

  3. matplotlib 入门之Sample plots in Matplotlib

    文章目录 Line Plot One figure, a set of subplots Image 展示图片 展示二元正态分布 A sample image Interpolating images ...

  4. python绘图工具matplotlib在linux下安装和使用

    工具介绍:matplotlib 是Python编程语言的一个绘图库及其数值数学扩展 NumPy.它为利用通用的图形用户界面工具包, 如Tkinter, wxPython, Qt或GTK+向应用程序嵌入 ...

  5. Python第三方库matplotlib(2D绘图库)入门与进阶

    Matplotlib 一 简介: 二 相关文档: 三 入门与进阶案例 1- 简单图形绘制 2- figure的简单使用 3- 设置坐标轴 4- 设置legend图例 5- 添加注解和绘制点以及在图形上 ...

  6. matplotlib之pyplot 学习示例

    现在通过numpy和matplotlib.pyplot 在Python上实现科学计算和绘图,而且和matlab极为相像(效率差点,关键是方便简单) 这里有大量plots代码例子.  1. 简单的绘图( ...

  7. Matplotlib快速入门

    Matplotlib 可能还有小伙伴不知道Matplotlib是什么,下面是维基百科的介绍. Matplotlib 是Python编程语言的一个绘图库及其数值数学扩展 NumPy.它为利用通用的图形用 ...

  8. 使用matplotlib画图

    一.介绍 官方文档:https://www.matplotlib.org.cn/home.html 安装:pip install matplotlib Matplotlib是一个Python 2D绘图 ...

  9. Python画各种 3D 图形Matplotlib库

    回顾 2D 作图 用赛贝尔曲线作 2d 图.此图是用基于 Matplotlib 的 Path 通过赛贝尔曲线实现的,有对赛贝尔曲线感兴趣的朋友们可以去学习学习,在 matplotlib 中,figur ...

随机推荐

  1. ABAP基础篇1 内表

    内表类型 abap 内表类型有三种: 标准表(一般ABAP程序中用的最多就是这种表) 系统为该表的每一行数据生成一个逻辑索引,自己内部维护着行号(Index)的编码.表的键值不唯一,且没有按照表键自动 ...

  2. python:字符串中提取特定的数据

    在日志文件中有一大堆,格式相同的文本,需要提取出接口耗时的时间 >>> 运单号:71742507538566,快递100接口耗时:8,返回结果:[{"lengthPre&q ...

  3. 【Docker学习之一】初始Docker

    一.云计算的概念 PaaS(Platform-as-a-Service:平台即服务),把应用服务的运行和开发环境作为一种服务.SaaS(Software-as-a-Service),意思为软件即服务, ...

  4. python/shell代码片段

    查看某模块路径 Bash pip show --files selenium 文件编码转换 Bash convmv -f GBK -t UTF-8 --notest -r ydcz_1/ 查找当前目录 ...

  5. django使用https

    根据以下内容总结了下: http://www.voidcn.com/article/p-xxdfvetx-da.html http://www.voidcn.com/article/p-ezmbnny ...

  6. pom中parent和dependency区别以及dependencyManagement区别

    真的很详细 很感动 1.在同一个pom文件下,如果<dependencies>和<dependencyManagement>中都对该jar做了依赖,以<dependenc ...

  7. 手撕面试官系列(五):Tomcat+Mysql+设计模式面试专题

    Tomcat (面试题+答案领取方式见侧边栏) Tomcat 的缺省端口是多少,怎么修改? tomcat 有哪几种 Connector 运行模式(优化)? Tomcat 有几种部署方式? tomcat ...

  8. STVD使用printf输出数据错误

    使用STM8L052输出调试信息 重定向put char #include "stdio.h" //必不可缺少 char putchar (char c) { /* Write a ...

  9. 复制Linux虚拟机(VMware vSphere Client 工具)

    1.VMware vSphere Client 工具 登录,如下图          IP.用户名/密码均是物理机,登录完成界面: 2.选择一个复制的原虚拟机 A,点击左上角[文件]——导出——导出O ...

  10. 正在阅读的tex教程

    https://liam.page/2014/09/08/latex-introduction/ https://www.jianshu.com/p/1d99b3c883a6 http://www.c ...