简体   繁体   English

多层图

[英]Multi-layer Plot in plolty

Can we plot another layer of plot over a visualization using plotly through python.? 我们是否可以通过python使用plotly在可视化上绘制另一层绘图?

I am trying to join two points over a bubble chart. 我试图在气泡图上加入两点。

You should be aware of the concept of traces, where we can place two types of charts in the same graph. 您应该了解跟踪的概念,在这里我们可以将两种类型的图表放在同一张图中。 To see the concept in action refer Multiple Chart Types in Same Graph . 要了解实际使用的概念,请参考同一图中的多种图表类型 Just as a starting point please refer the below code snippet which does what you want. 只是作为起点,请参考下面的代码片段,该代码片段可以满足您的需求。

from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
import plotly.graph_objs as go
from datetime import datetime
init_notebook_mode(connected=True)

trace0 = go.Scatter(
    x=[1, 2, 3, 4],
    y=[10, 11, 12, 13],
    mode='markers',
    marker=dict(
        size=[40, 60, 80, 100],
    )
)
trace1 = go.Scatter(
    x = [1, 2, 3, 4],
    y = [10, 11, 12, 13],
    line = dict(
        color = ('rgb(22, 96, 167)'),
        width = 4,
        dash = 'line')
)

data = [trace0, trace1]
iplot(data, filename='bubblechart-size')

The line that you require can also be generated using plotly shapes. 您所需的线也可以使用绘图形状生成。 Please read more about this here 在这里了解更多

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM