enable plotting vs time on 23 and 25 hour days
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 18.8k
- Forks
- 2.8k
- Ø Merge
- 16 Std. 26 Min.
- Gemergte PRs (30 T.)
- 21
Beschreibung
I'm trying to find a way to plot values over time on 23 and 25 hour days for daylight savings time (DST). Below is my example code that illustrates the problem, and the two resulting plots. The time stamps in x_23 and x_25 are all one hour apart. They reflect the "US/Pacific" time zone. In the spring forward case, I would expect to see twenty-three hours along the x-axis. And, in fall back, twenty-five. But, both times plotly shows 24. In spring forward, there is a visual gap in the spacing of the second and third markers. And, in fall back, there is a visual overlap.
A suggested approach would be to allow the programmer to optionally assign a time zone to the x-axis. In my case, I would assign US/Pacific. Then, plotly knows to adjust for DST if applicable. Might also want to allow assignment of a 'local' time zone. In that case, plotly would get the timezone from the computer on which it's running. If the programmer makes no assignment, plotly's behavior remains as is. Nobody's code gets broken.
A similar alternative would be to allow the programmer to set a flag to true if they want the behavior that is aware of DST. A value of false would keep the current behavior. Again, nobody's code gets broken.
I found two similar issues, but neither was really addressed.
https://github.com/plotly/plotly.js/issues/171
https://github.com/plotly/plotly.js/issues/4358
import plotly.graph_objects as go
# Spring Forward
x_23 = ["2001-04-01T00:00:00-08:00", "2001-04-01T01:00:00-08:00", "2001-04-01T03:00:00-07:00",
"2001-04-01T04:00:00-07:00", "2001-04-01T05:00:00-07:00", "2001-04-01T06:00:00-07:00",
"2001-04-01T07:00:00-07:00", "2001-04-01T08:00:00-07:00", "2001-04-01T09:00:00-07:00",
"2001-04-01T10:00:00-07:00", "2001-04-01T11:00:00-07:00", "2001-04-01T12:00:00-07:00",
"2001-04-01T13:00:00-07:00", "2001-04-01T14:00:00-07:00", "2001-04-01T15:00:00-07:00",
"2001-04-01T16:00:00-07:00", "2001-04-01T17:00:00-07:00", "2001-04-01T18:00:00-07:00",
"2001-04-01T19:00:00-07:00", "2001-04-01T20:00:00-07:00", "2001-04-01T21:00:00-07:00",
"2001-04-01T22:00:00-07:00", "2001-04-01T23:00:00-07:00", "2001-04-02T00:00:00-07:00"]
y_23 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]
fig_23 = go.Figure(data=[go.Scatter(x=x_23, y=y_23, mode="lines+markers")])
fig_23.update_layout(title="Spring Forward")
fig_23.show()
# Fall Back
x_25 = ["2001-10-28T00:00:00-07:00", "2001-10-28T01:00:00-07:00", "2001-10-28T01:00:00-08:00",
"2001-10-28T02:00:00-08:00", "2001-10-28T03:00:00-08:00", "2001-10-28T04:00:00-08:00",
"2001-10-28T05:00:00-08:00", "2001-10-28T06:00:00-08:00", "2001-10-28T07:00:00-08:00",
"2001-10-28T08:00:00-08:00", "2001-10-28T09:00:00-08:00", "2001-10-28T10:00:00-08:00",
"2001-10-28T11:00:00-08:00", "2001-10-28T12:00:00-08:00", "2001-10-28T13:00:00-08:00",
"2001-10-28T14:00:00-08:00", "2001-10-28T15:00:00-08:00", "2001-10-28T16:00:00-08:00",
"2001-10-28T17:00:00-08:00", "2001-10-28T18:00:00-08:00", "2001-10-28T19:00:00-08:00",
"2001-10-28T20:00:00-08:00", "2001-10-28T21:00:00-08:00", "2001-10-28T22:00:00-08:00",
"2001-10-28T23:00:00-08:00", "2001-10-29T00:00:00-08:00"]
y_25 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]
fig_25 = go.Figure(data=[go.Scatter(x=x_25, y=y_25, mode="lines+markers")])
fig_25.update_layout(title="Fall Back")
fig_25.show()


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, die Beispiele für die Umstellung auf Sommerzeit und zurück auf Normalzeit im Issue zu reproduzieren, und vergleiche den dargestellten Abstand mit den erwarteten Zeitverläufen von 23 bzw. 25 Stunden. Sieh dir die verwandten Issues #171 und #4358 an, bevor du den Umfang festlegst. Als erledigt gilt die Aufgabe, wenn das im Issue angeforderte DST-aware Plotting-Verhalten unterstützt wird, ohne das Verhalten zu ändern, wenn keine Zeitzone und kein Flag angegeben ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- data-visualization
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100