<jupyter_start><jupyter_text>3次元グラフ<jupyter_code>import matplotlib.pyplot as plt
import numpy as np<jupyter_output><empty_output><jupyter_text>まずはデータ用意<jupyter_code>z = np.arange(-2*np.pi, 2*np.pi, 0.01)
x = np.cos(z)
y = np.sin(z)<jupyter_output><empty_output><jupyter_text>3次元のグラフにするにはadd_ubplotの引数projectionを3dに設定する```fig.add_subplot(projection='3d')```<jupyter_code>fig = plt.figure()
ax = fig.add_subplot(projection='3d')
ax.plot(x, y, z, label="hoge")
plt.show()<jupyter_output><empty_output><jupyter_text>それ以外は平面のときと同じ<jupyter_code>x2 = np.cos(z+np.pi); y2 = np.sin(z+np.pi)

fig = plt.figure()
ax = fig.add_subplot(projection='3d')
ax.plot(x, y, z, label="1", linestyle='solid', color="blue")
ax.plot(x2, y2, z, label="2", linestyle='dashed', color="green")
ax.set_xlabel("x")
ax.set_ylabel("y")
ax.set_zlabel("z")
ax.legend()
ax.grid()
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1943502824858757, 'fraction_numerical': 0.0192090395480226, 'mean_word_length': 9.423529411764706, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '507694', 'license': 'MIT', 'n_tokens_mistral': 440, 'n_tokens_neox': 429, 'n_words': 48, 'path': 'graph/python_src/3d.ipynb', 'repo_name': 'YoshimitsuMatsutaIe/abc_2022', 'size': '885'}