我正在使用 plotly.figure_factory 制作子弹图。我得到了输出,但我想在轴上方而不是在轴上提供标记。我什么都试过了。谁能帮我吗?
import os
def main():
data = [
{"label": "<span style='color: orange'>revenue</span>",
"sublabel": "us$, in thousands",
"range": [150, 225, 300],
"performance": [220,270],
"point": [220]},
{"label": "<span style='color: orange'>Profit</span>",
"sublabel": "%",
"range": [20, 25, 30],
"performance": [21, 23],
"point": [21]},
{"label": "<span style='color: orange'>Order Size</span>",
"sublabel":"US$, average",
"range": [350, 500, 600],
"performance": [100,320],
"point": [100]},
{"label": "<span style='color: orange'><b>New</b><br> Customers</span>",
"sublabel": "count",
"range": [1400, 2000, 2500],
"performance": [1000, 1650],
"point": [1000]},
{"label": "<span style='color: orange'>Satisfaction</span>",
"sublabel": "out of 5",
"range": [3.5, 4.25, 5],
"performance": [3.2, 4.7],
"point": [3.2]}
]
fig = ff.create_bullet(
data, titles='label',
subtitles='sublabel',
markers='point',
measures='performance',
ranges='range',
orientation='h',
title='my simple bullet chart',
scatter_options= {
'cliponaxis': False,
'marker': {
'symbol': 'triangle-down',
'size': 20,
'color': 'royalblue',
'x': 20
# 'opacity': 0.7,
},
}
)
# update_xaxes
fig.update_yaxes(layer="below traces")
fig.update_xaxes(ticks="outside")
if not os.path.exists('pic'):
os.mkdir('pic')
fig.write_image('pic/size.png')
if __name__ == '__main__':
main()
我想要实现的目标:https ://i.stack.imgur.com/XI4Ar.png