plotly / plotly/plotly.py

allow aligning hovertext for annotations

Offen
#3,583 1 Kommentar 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

feature P3
Vorherrschende Sprache
Python
Sterne
18.8k
Forks
2.8k
Ø Merge
16 Std. 26 Min.
Gemergte PRs (30 T.)
21

Beschreibung

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!

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit den in f.add_annotation gezeigten Annotation-APIs und dem Verhalten von hoverlabel_align in f.update_layout und verfolge dann, wie Optionen für Annotation-Hovertext verfügbar gemacht werden. Als erledigt gilt die Aufgabe, wenn Annotation-Hovertexte eine explizite Ausrichtungseinstellung erhalten können, einschließlich der im Issue beschriebenen Beispiele für die linke und rechte Ausrichtung.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
plotly, python
Bereich
data-visualization
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.