mirror of
https://github.com/Estom/notes.git
synced 2026-04-02 02:20:25 +08:00
matplotlib & pandas
This commit is contained in:
34
Python/matplotlab/gallery/mplot3d/surface3d_2.md
Normal file
34
Python/matplotlab/gallery/mplot3d/surface3d_2.md
Normal file
@@ -0,0 +1,34 @@
|
||||
# 三维曲面(纯色)
|
||||
|
||||
使用纯色演示3D表面的基本图。
|
||||
|
||||

|
||||
|
||||
```python
|
||||
# This import registers the 3D projection, but is otherwise unused.
|
||||
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
|
||||
fig = plt.figure()
|
||||
ax = fig.add_subplot(111, 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()
|
||||
```
|
||||
|
||||
## 下载这个示例
|
||||
|
||||
- [下载python源码: surface3d_2.py](https://matplotlib.org/_downloads/surface3d_2.py)
|
||||
- [下载Jupyter notebook: surface3d_2.ipynb](https://matplotlib.org/_downloads/surface3d_2.ipynb)
|
||||
Reference in New Issue
Block a user