for plot in [p1, p3, p5]:
plot.add_tools(HoverTool(
tooltips=[
("(x,y, name)", "($x, $y, $name"), # use @{ } for field names with spaces
],
formatters={
'date': 'datetime', # use 'datetime' formatter for 'date' field
'adj close': 'printf', # use 'printf' formatter for 'adj close' field
# use default 'numeral' formatter for other fields
},
# display a tooltip whenever the cursor is vertically in line with a glyph
# mode='hline'
mode='mouse'
))
您可以使用Bokeh框架作为matplotlib的替代方案。(我个人觉得好多了。)
在matplotlib docAnnotations中,可以使用以下代码修改示例
相关问题 更多 >
编程相关推荐