[Question] How to use plot_surface of python

I am using python3. When I googled, it came out that I should write the following code to write a sphere with matplotlib. However, here we use matrices for x, y, and z as arguments to plot_surface. What kind of calculation does this do internally and plot the graph? If anyone knows, please professor. Thank you.

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()

Recommended Posts

[Question] How to use plot_surface of python
[Python] Summary of how to use pandas
[Python2.7] Summary of how to use unittest
Summary of how to use Python list
[Python] How to use two types of type ()
python3: How to use bottle (2)
[Python] How to use list 1
Summary of how to use MNIST in Python
Python: How to use pydub
[Python] How to use checkio
[Python] How to use input ()
[Python] How to use virtualenv
python3: How to use bottle (3)
python3: How to use bottle
How to use Python bytes
I tried to summarize how to use matplotlib of python
How to use Python Kivy ① ~ Basics of Kv Language ~
Python: How to use async with
Summary of how to use pandas.DataFrame.loc
[Python] How to use Pandas Series
Summary of how to use pyenv-virtualenv
How to use Mysql in python
How to use OpenPose's Python API
How to use ChemSpider in Python
How to use FTP with Python
How to use PubChem in Python
How to use python zip function
Summary of how to use csvkit
[Python] How to use Typetalk API
[Python] Summary of how to use split and join functions
Comparison of how to use higher-order functions in Python 2 and 3
[Introduction to Python] How to use class in Python?
How to install and use pandas_datareader [Python]
[python] How to use __command__, function explanation
How to calculate Use% of df command
[Python] How to use import sys sys.argv
Memorandum on how to use gremlin python
python: How to use locals () and globals ()
How to use __slots__ in Python class
Jupyter Notebook Basics of how to use
How to use "deque" for Python data
Basics of PyTorch (1) -How to use Tensor-
How to use Python zip and enumerate
How to use regular expressions in Python
How to use is and == in Python
[Blender x Python] How to use modifiers
How to use Python Kivy (reference) -I translated Kivy Language of API reference-
Basic grammar of Python3 system (how to use functions, closures, lambda functions)
How to use xml.etree.ElementTree
How to use Python-shell
How to use tf.data
How to use virtualenv
How to use Seaboan
How to use image-match
How to install Python
How to use Pandas 2
How to use Virtualenv
How to use pytest_report_header
How to install python
How to use Bio.Phylo
How to use SymPy