plotly / plotly/plotly.py

allow aligning hovertext for annotations

未關閉
#3,583 1 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

feature P3
主要語言
Python
星號
18.8k
分支
2.8k
平均合併
16 小時 26 分鐘
30 天內合併 PR
21

描述

It looks like there is no way to control the text justification for annotation hovertexts. For example:

# Make an background image
f = px.imshow( [[255]*6]*3, origin='lower')

# Add two annotations with hovertext
f.add_annotation( x=1, y=1, text='left', hovertext='Will be left justified<br>*', showarrow=False)
f.add_annotation( x=5, y=1, text='right', hovertext='Will be right justified<br>*', showarrow=False)

# Tighten the plot
f.update_layout( margin={'l':0, 'r':0, 't':0, 'b':0}, coloraxis_showscale=False)

# This will not apply on the annotation hovertext
f.update_layout( hoverlabel_align='left') 

# This does not exist and annotation hovertexts default to auto
# f.update_annotations( hoverlabel_align='left')

f.show()

The image hovertexts will be all properly left-justified, but the annotation hovertexts will default to 'auto', with the left one being left-justified, and the right one being right-justified. Am I missing something, or this is an omission in the tunable options? Is there some other way to force left-justification on the annotation hovertexts? I produce a set of tables that way that look atrocious otherwise.

Thanks!

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

從 f.add_annotation 中展示的 annotation API 和 f.update_layout 中 hoverlabel_align 的行為開始,接著追蹤 annotation hovertext 選項是如何暴露的。完成的標準是 annotation hovertext 可以接收明確的對齊設定,包括 issue 中描述的靠左和靠右範例。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
plotly, python
領域
data-visualization
Issue 類型
功能
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。