-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix for issue 5575 along with testing #6091
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
Conversation
Can you add only png tests for this (and re-base the pdf/svg tests out of existence)? The reason is to keep the size of the repo down and to keep the tests as fast as possible. There is nothing backend dependent about this so testing it only on Agg should be enough. Other wise 👍 It is great when problems have simple fixes! Can you also put the explanation of why this fixed the problem in the commit message? |
Done. Let me know if I missed anything in the pull request/commit. |
Can you rebase this to only one commit? Currently the svg/pdf are still in the history which means they are (forever) in the repository. |
If you just keep pu |
If you just keep (force) pushing to this branch github will 'do the right thing'. PRs track branches, not commits. |
extensions=['png']) | ||
def test_date_timezone_x(): | ||
#Tests issue 5575 | ||
time_index = [pytz.timezone('Canada/Eastern').localize(datetime.datetime(year=2016, month=2, day=22, hour=x)) for x in range(3)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is too long; it should be wrapped at 79 characters.
… updates the units with the right timezone, before actually plotting the dates. Includes tests to ensure consistency and correctness
Sorry about earlier, I mis-clicked "Close and comment" instead of "comment". I have rebased and made the pep8 changes that I admittedly forgot to do. Thank you |
FIX: plot_date ignores timezone Closes #5575 Conflicts: lib/matplotlib/tests/test_axes.py multiple PRs added tests at same location in file keep all.
FIX: plot_date ignores timezone Closes #5575 Conflicts: lib/matplotlib/tests/test_axes.py multiple PRs added tests at same location in file keep all.
FIX: plot_date ignores timezone Closes matplotlib#5575 Conflicts: lib/matplotlib/tests/test_axes.py multiple PRs added tests at same location in file keep all.
This is a pull request to resolve issue #5575.
Tracing calls made in plot_date() I realized it was ignoring timezones as a result of the axis being set while plotting, then trying to change the time zone.
In line 1427 of axis.py we have
converter = munits.registry.get_converter(data)
. Unfortunately for setting the timezone the converter will be the same as when it was plotted originally. Thus in the following lines 1433-1435 we will not be able to set_units.My solution to this was to make sure that instead of the following in _axes.py's plot_data:
we have:
This ensures the plot has the correct timezone, and it also plots the correct data onto the plot.
I have added test cases to /lib/matplotlib/tests/test_axes which has tests for the same and different timezones in the x axis, y axis, and both the x and y axis