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

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

散景 - 為補丁圖上的單個字形創建自定義懸停工具

散景 - 為補丁圖上的單個字形創建自定義懸停工具

收到一只叮咚 2021-10-05 16:16:54
我大致按照Bokeh 文檔中的 texas.py 示例創建了一張地圖。我正在嘗試在地圖上添加一個具有自己鼠標懸停行為的點。我添加了以下字形:bc_glyph = Circle(x=barclays_x, y=barclays_y, size=10, line_color="black", fill_color="silver", line_width=1)我嘗試使用以下方法創建自定義 HoverTool 行為:bc_ht = HoverTool(renderers=['bc_glyph'], tooltips=['Barclays Stadium'])然后我打了電話plot.add_glyph(bc_glyph)。運行我的腳本時,我得到以下輸出:ValueError: expected an element of either Auto or List(Instance(Renderer)), got ['bc_glyph']錯誤消息的快速谷歌導致Bryan 幫助另一個用戶解決類似問題,所以我重寫如下:plot_add = plot.add_glyph(bc_glyph) bc_ht = HoverTool(renderers=['plot_add'], tooltips=['Barclays Stadium'])但是,這會返回相同的錯誤:ValueError: expected an element of either Auto or List(Instance(Renderer)), got ['plot_add']我知道我向 提供了錯誤的輸入renderers,但我不確定如何更正。任何幫助表示贊賞。
查看完整描述

1 回答

?
蕭十郎

TA貢獻1815條經驗 獲得超13個贊

您仍在傳遞一個字符串, 'plot_add', 作為值。您需要傳遞實際變量:


bc_ht = HoverTool(renderers=[plot_add],           # no quote around plot_add

                  tooltips=['Barclays Stadium'])


查看完整回答
反對 回復 2021-10-05
  • 1 回答
  • 0 關注
  • 255 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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