亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

使用散景繪圖時如何為多個數據集之一添加懸停工具

使用散景繪圖時如何為多個數據集之一添加懸停工具

喵喔喔 2022-06-28 17:16:37
我在 Python 中使用 Bokeh 繪制兩個數據集。我將一個數據集繪制為一條線,另一個作為標記(圓圈十字)。我正在嘗試為標記數據集添加一個懸停工具。source = ColumnDataSource(df_bcn_rns)p = figure(plot_height=300,           plot_width=800,           tools="",           toolbar_location=None,           x_axis_type='datetime',           x_axis_location="above",           background_fill_color="#efefef") #,x_range=(bcn_sp.index[-1], bcn_sp.index[0])p.line(x=bcn_sp['Date'],       y=bcn_sp['Close'])#,source=source)p.circle_cross(x='Date',               y='price',               source=source)p.yaxis.axis_label = 'Closing Price'p.add_tools(HoverTool(        tooltips=[( 'date',   '@Date{%d-%m-%Y}'),                  ( 'price',  '@price{00.2f}p'), # use @{ } for field names with spaces                  ( 'rns header', '@Headline')],        formatters={'Date' : 'datetime', # use 'datetime' formatter for 'date' field                    'close' : 'printf'},   # use 'printf' formatter for 'adj close' field        mode='vline' # display a tooltip whenever the cursor is vertically in line with a glyph    ))show(column(p)) #,select上面的代碼有效,但是,當鼠標懸停在任一數據集上時,懸停工具會顯示。當鼠標懸停在線數據集上時,顯示“???” 在懸??蛑校也幌M@示任何內容??偠灾移谕慕Y果是鼠標懸停在標記上時顯示的懸???,但只要鼠標懸停在行上時就沒有懸??颍驗榇藬祿存溄拥健霸础?。有什么建議我可以解決這個問題嗎?
查看完整描述

1 回答

?
阿波羅的戰車

TA貢獻1862條經驗 獲得超6個贊

markers = p.circle_cross(...)返回一個markers渲染器,您需要將其指定為HoverTool在此處查看兩個可能的選項



查看完整回答
反對 回復 2022-06-28
  • 1 回答
  • 0 關注
  • 172 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號