matplotlib笔记04

坐标系

1、直角坐标系

默认的就是二维直角坐标系

三维直角坐标系

from matplotlib.pyplot import plt
from mpl_toolkits.mplot3d import axes3d

fig=plt.figure()
ax=fig.gca(projection='3d')
# fig.gca() 当前fig里的axes对象
# projection 设置坐标系

ax.view_init(elev=elev,azim=azim)
# 调整相机视角,elev沿y轴转,azim沿z轴转

三维直角坐标系的一些主要参数
三维曲线图

ax.plot()
# xs xy xz
# color
# linestyle
# linewidth
# marker
# markeredgecolor
# markeredgewidth
# markerfacecolor
# markersize
# lable

三维散点、气泡图

ax.scatter3D()
# xs ys zs zdir往哪个平面投影
# s 散点大小
# c 散点颜色
# label
# marker
# linewidths
# edgecolors

三维柱状图

ax.bar3d()
# x y z
# dx dy dz 延伸坐标
# color
# edgecolor
# linewidth

三维等高线

ax.contour()
# X Y Z
# cmap 颜色映射主题

三维等高面

ax.contourf()
# X Y Z
# cmap

三维曲面图

ax.plot_surface()
# X Y Z
# rstride 行平滑程度
# cstride 列平滑程度
# map 颜色映射主题
# vmin vmax 设置显示的区间
# edgecolor
# shade

三维网面图

ax.plot_wireframe()
# X Y Z
# cmap
# linestyles

三维块状图

ax.voxels()
# filled
# x y z
# facecolors
# edgecolors

2、极坐标系

# 直角转为极坐标
x=ρcos
y=ρsinθ

# 极坐标转直角
θ=tan^(-1)(y/x)
r=(x^2+y^2)^(1/2)
fig=figure()
ax=fig.gca(polar=True)

ax.set_theta_offset(np.pi/2)
# theta就是θ
# 设置极坐标的起始角度为90度

ax.set_theta_direction(-1)
# 设置极坐标的顺时针为正,逆时针是1

ax.set_rlabel_position(0)
# 设置极坐标Y轴的坐标标签位置为起始位置

3、地理坐标系

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值