<p>你可以和<a href="https://plot.ly/python/" rel="noreferrer">Plotly</a>图书馆一起去。它可以直接在Jupyter笔记本中渲染交互式3D绘图。</p>
<p>为此,首先需要通过运行以下命令以绘图方式安装:</p>
<pre><code>pip install plotly
</code></pre>
<p>您可能还希望通过运行以下命令来升级库:</p>
<pre><code>pip install plotly --upgrade
</code></pre>
<p>之后,你可以在笔记本上写下如下内容:</p>
<pre><code># Import dependencies
import plotly
import plotly.graph_objs as go
# Configure Plotly to be rendered inline in the notebook.
plotly.offline.init_notebook_mode()
# Configure the trace.
trace = go.Scatter3d(
x=[1, 2, 3], # <-- Put your data instead
y=[4, 5, 6], # <-- Put your data instead
z=[7, 8, 9], # <-- Put your data instead
mode='markers',
marker={
'size': 10,
'opacity': 0.8,
}
)
# Configure the layout.
layout = go.Layout(
margin={'l': 0, 'r': 0, 'b': 0, 't': 0}
)
data = [trace]
plot_figure = go.Figure(data=data, layout=layout)
# Render the plot.
plotly.offline.iplot(plot_figure)
</code></pre>
<p>因此,以下图表将在Jupyter笔记本中为您绘制,您将能够与之交互。当然,你需要提供你的具体数据,而不是建议的数据。</p>
<p><a href="https://i.stack.imgur.com/uZBzC.png" rel="noreferrer"><img src="https://i.stack.imgur.com/uZBzC.png" alt="enter image description here"/></a></p>