1 Star 0 Fork 0

朱康宝/CSDN

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
plot_3d.py 1.03 KB
一键复制 编辑 原始数据 按行查看 历史
朱康宝 提交于 2018-12-17 14:46 +08:00 . plot_3d
# -*- coding: utf-8 -*-
"""
date: Mon Dec 17 14:41:11 2018
python: Anaconda 3.6.5
author: kanade
email: kanade@blisst.cn
"""
import numpy as np
import matplotlib.pyplot as mp
from mpl_toolkits.mplot3d import axes3d
# 生成数据
n = 1000
x, y = np.meshgrid(np.linspace(-3, 3, n),
np.linspace(-3, 3, n))
z = (1 - x / 2 + x ** 5 + y ** 3) * np.exp(
-x ** 2 - y ** 2)
mp.figure('3D Wireframe')
ax = mp.gca(projection='3d')
mp.title('3D Wireframe', fontsize=20)
# 设置坐标轴标签
ax.set_xlabel('x', fontsize=14)
ax.set_ylabel('y', fontsize=14)
ax.set_zlabel('z', fontsize=14)
# 绘制三维线框图
ax.plot_wireframe(
x, y, z, rstride=30, cstride=30,
linewidth=0.5, color='dodgerblue')
mp.figure('3D Surface')
ax = mp.gca(projection='3d')
mp.title('3D Surface', fontsize=20)
ax.set_xlabel('x', fontsize=14)
ax.set_ylabel('y', fontsize=14)
ax.set_zlabel('z', fontsize=14)
# 绘制三维表面图
ax.plot_surface(
x, y, z, rstride=10, cstride=10, cmap='jet')
mp.show()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/kanadeblisst/CSDN.git
git@gitee.com:kanadeblisst/CSDN.git
kanadeblisst
CSDN
CSDN
master

搜索帮助