关于对四维图的生成的探讨
import numpy as npfrom matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
# 定义坐标轴
fig = plt.figure()
ax1 = plt.axes(projection='3d')
# ax = fig.add_subplot(111,projection='3d')#这种方法也可以画多个子图
z = range(100)
x = range(100)
y = 5 * np.cos(z)
# zd = 13 * np.random.random(100)
# xd = 5 * np.sin(zd)
# yd = 5 * np.cos(zd)
cmp = plt.cm.get_cmap('rainbow')
# ax1.scatter3D(xd,yd,zd, cmap='rainbow')#绘制散点图
for i in range(len(x) - 1):
plt.plot(, x], , y], linewidth=5, color=cmp(x / max(x)))
#ax1.scatter3D(z, z, z, cmap='rainbow', color=cmp(x / max(x)))# 绘制散点图
但是在绘制3D图时 却无法让颜色多样(四维 就第四维就是颜色) 很强啊,楼主在哪里呀?
页:
[1]