Bar plot shows too many ticks
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- R
- Sterne
- 2.7k
- Forks
- 641
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
In plotly 4.10.4 a bar plot with only one date observation shows actually multiple ticks when the ticks' format is converted. Here a minimal reproducible example:
library(dplyr)
library(plotly)
df <- tibble(Time = "2025-01", Animal = "Monkey", value = 2)
df %>%
plot_ly(x = ~Time, y= ~value, color = ~Animal) %>%
layout(
xaxis = list(
type = "date",
tickformat = "%b '%y"
)
)
This is not the case though for a stacked bar plot:
df <- tibble(Time = c("2025-01", "2025-01"), Animal = c("Monkey", "Lion"), value = c(2, 3))
df %>%
plot_ly(x = ~Time, y= ~value, color = ~Animal) %>%
layout(
barmode = "stacked",
xaxis = list(
type = "date",
tickformat = "%b '%y"
)
)
When looking at the dates without formatting one can see a few minimal shifts around the actual date:
df <- tibble(Time = "2025-01", Animal = "Monkey", value = 2)
df %>%
plot_ly(x = ~Time, y= ~value, color = ~Animal) %>%
layout(
xaxis = list(
type = "date"
)
)
Is this already somewhere addressed?
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, das R-Beispiel mit einer einzigen Beobachtung mit plot_ly() sowie den Optionen für den xaxis-Typ und tickformat auszuführen, und vergleiche es dann mit den Beispielen für gestapelte Balken und ohne Formatierung. Verfolge, wie die Datumsachse und die Tick-Formatierung gehandhabt werden; abgeschlossen ist die Aufgabe, wenn das Balkendiagramm mit einem einzigen Datum den erwarteten Tick anzeigt, ohne zusätzliche formatierte Ticks einzuführen, während das bestehende Verhalten bei gestapelten Balken unverändert bleibt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- r
- Bereich
- data-visualization
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100