plotly - Plotly 中的 float 棒图

标签 plotly

如何使用 Plotly 生成这种类型的“ float 棒”(或“高/低”)图表? ?我浏览了这些示例,但找不到任何完全相同的东西 - 最重要的是设置不从零开始的条/棒。

请注意,这些线不是误差线。

Example plot

最佳答案

制作棒图的一种方法是在 asymmetric error bars 上使用负偏移量有zero width 。这是一个例子:

import plotly.plotly as py
from plotly.graph_objs import ErrorY, Scatter

x = [1, 2, 3, 4]
y = [4, 7, 5, 9]
stick_top = [10, 6, 7, 11]
stick_bottom = [6, 4, 3, 4]

error_bar_positive_offset = [si - yi for (yi, si) in zip(y, stick_top)]
error_bar_negative_offset = [yi - si for (yi, si) in zip(y, stick_bottom)]

py.plot([
    Scatter(x=x, y=y, mode='markers',
        error_y=ErrorY(
            symmetric=False, 
            array=error_bar_positive_offset, 
            arrayminus=error_bar_negative_offset,
            width=0
        )
    )], filename='stick-chart')

Stick chart made with Plotly https://plot.ly/~chris/15416

关于plotly - Plotly 中的 float 棒图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30478268/

相关文章:

python - choropleth Plotly map 中的自定义垃圾箱

angular - TS2339 :Propert 'on' does not exist on type 'HTMLElement'

r - 文件错误(con, "rb"): cannot open the connection

javascript - Plotly JavaScript - donut chart - Hoverinfo,尝试使用数组添加自定义定义 - 我的代码的小问题

r - plotly 多 plotly 方面

python - 非矩形网格上的填充等值线图

r - 如何获取 ROC 曲线中 x 轴(FPR)和 y 轴(TPR)的值

python - 类型错误 : unsupported format string passed to Series. __format__

python - Plotly:如何在条形图中使用 for 循环或列表作为名称属性?

Python plotly legendgrouptitle_text 不作为 go.Scatter 参数