擅长:python、mysql、java
<p>是的!新手plot.ly公司有了这个问题,正如我在评论中提到的,出于各种原因,我不能仅仅在pandas/matplotlib中这样做。但是通过子图的魔力,你实际上可以通过将它们分块在一起来重新创建多轨迹图。
<a href="https://i.stack.imgur.com/6sKBb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6sKBb.png" alt="enter image description here"/></a></p>
<pre><code>import plotly.plotly as py
import plotly.graph_objs as go
from plotly import tools
trace1 = Bar(
x=['giraffes', 'orangutans', 'monkeys'],
y=[20, 14, 23],
name='SF Zoo'
)
trace2 = Bar(
x=['giraffes', 'orangutans', 'monkeys'],
y=[12, 18, 29],
name='LA Zoo'
)
trace3 = Scatter(
x=['giraffes', 'orangutans', 'monkeys']
,y=[33,20,17]
,name='subplots ftw'
)
fig = tools.make_subplots(rows=2, cols=1, shared_xaxes=True)
fig.append_trace(trace3, 1,1)
fig.append_trace(trace1, 2, 1)
fig.append_trace(trace2,2,1)
fig['layout'].update(height=600, width=600)
iplot(fig)
</code></pre>