最佳答案
制作棒图的一种方法是在 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')
关于plotly - Plotly 中的 float 棒图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30478268/