python如何绘制降水图


当前第2页 返回上一页

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

'''

File Name:   draw_3d

Description: 3D绘图

'''

import numpy as np

import matplotlib.pyplot as plt

from mpl_toolkits.mplot3d import Axes3D

# 3D 绘制

def draw_3D():

    fig = plt.figure()  # 定义一个窗口

    ax = Axes3D(fig)  # 绘制3D坐标

    # 设置x、y、z的值

    x = np.arange(-4, 4, 0.25)

    y = np.arange(-4, 4, 0.25)

    x, y = np.meshgrid(x, y)  # x-y 平面的网格

    r = np.sqrt(x ** 2 + y ** 2)

    z = np.sin(r)  # z值

    # 做出一个三维曲面,并将一个 colormap rainbow 填充颜色,之后将三维图像投影到 XY 平面上做一个等高线图

    # rstride 和 cstride 分别代表 row 和 column 的跨度。

    ax.plot_surface(x, y, z, rstride=1, cstride=1, cmap=plt.get_cmap('rainbow'))

    # 添加 XY 平面的等高线

    ax.contourf(x, y, z, zdir='z', offset=-2, cmap=plt.get_cmap('rainbow'))

    ax.set_zlim(-2, 2)

    plt.show()  # 展示

# start

if __name__ == '__main__':

    draw_3D()

以上就是python如何绘制降水图的详细内容,更多文章请关注木庄网络博客!!

返回前面的内容

相关阅读 >>

初级Python的学习之路

Python函数之bool([x])用法详解

Python安装包里idle在哪

[译]the Python tutorial#input and output

Python常见语句汇总

Python能解偏微分方程吗

如何在debian 9上安装Python 3.7?

如何列出一个目录的所有文件

Python 编的著名游戏

都是第一次玩deepfakes

更多相关阅读请进入《Python》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...