Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time Shift Issue: plot Function Displays Time One Hour Off Compared to Bar Graph #206

Open
maxkinast opened this issue May 17, 2024 · 1 comment

Comments

@maxkinast
Copy link

Hello,

I am encountering an issue where the time is shifted by one hour when rendering a graph with plot. However, in the bar graph, the time appears normal.

import plotext as plt
from datetime import datetime

prices = [5.722, 5.778, 5.778, 5.778, 5.778, 5.75, 5.76, 5.764, 5.764, 5.764, 5.802, 5.836, 5.836, 5.836, 5.834, 5.834, 5.8, 5.848, 5.816, 5.8]
dates = ['08:00:43', '08:44:03', '08:46:15', '09:14:15', '09:43:43', '10:02:44', '10:08:16', '10:14:07', '10:31:04', '10:43:55', '11:13:29', '11:25:22', '11:29:42', '11:44:03', '12:13:13', '12:35:43', '12:44:01', '12:58:41', '13:00:23', '13:13:48']
volume = [0.0, 20.0, 150.0, 0.0, 0.0, 91.0, 100.0, 0.0, 174.0, 0.0, 0.0, 5.0, 8.0, 0.0, 0.0, 8.0, 0.0, 513.0, 46.0, 0.0]


plt.subplots(2, 1)


plt.subplot(1, 1)
plt.date_form('H:M:S')
plt.title("Energy Fuels")
plt.theme('clear')
plt.plot(dates, prices)

plt.subplot(2, 1)
plt.date_form('H:M:S')
plt.theme('clear')
plt.title("Volume")
plt.bar(dates, volume)

plt.show()

print(dates)
print(prices)
print(volume)

As you can see in the attached photo, both graphs start at different time points despite using the same variable with the same time data.
image

@piccolomo
Copy link
Owner

Just to update and apologise: I have been quite busy rewriting the package from ground up and will update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants