LoginSignup
1
4

More than 5 years have passed since last update.

【質問】pythonのplot_surfaceの使い方について

Posted at

python3を使っております。ググったところ、matplotlibで球を書くには下のようなコードを書けばよいと出てきました。しかし、ここではplot_surfaceの引数として、x、y、zそれぞれに行列を用いています。これは、内部でどのような計算を行い、グラフをプロットしているのでしょうか?どなたか分かる方ご教授お願いします。
よろしくお願いします。

from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np


fig = plt.figure()
ax = fig.gca(projection='3d')

# Make data
u = np.linspace(0, 2 * np.pi, 100)
v = np.linspace(0, np.pi, 100)
x = 10 * np.outer(np.cos(u), np.sin(v))
y = 10 * np.outer(np.sin(u), np.sin(v))
z = 10 * np.outer(np.ones(np.size(u)), np.cos(v))

# Plot the surface
ax.plot_surface(x, y, z, color='b')

plt.show()

1
4
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
4