8000 Merge 1.5 into 2x. by jenshnielsen · Pull Request #6187 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Merge 1.5 into 2x. #6187

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

Merged
merged 17 commits into from
Mar 19, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge pull request #6091 from KyleBsingh/master
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.
  • Loading branch information
tacaswell committed Mar 13, 2016
commit 44afc736ce8f88422bb7157fba0fc764c6d64f10
4 changes: 2 additions & 2 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1491,13 +1491,13 @@ def plot_date(self, x, y, fmt='o', tz=None, xdate=True, ydate=False,
if not self._hold:
self.cla()

ret = self.plot(x, y, fmt, **kwargs)

if xdate:
self.xaxis_date(tz)
if ydate:
self.yaxis_date(tz)

ret = self.plot(x, y, fmt, **kwargs)

self.autoscale_view()

return ret
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 55 additions & 0 deletions lib/matplotlib/tests/test_axes.py
8000
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

import datetime

import pytz

import numpy as np
from numpy import ma
from numpy import arange
Expand Down Expand Up @@ -4213,6 +4215,7 @@ def test_pandas_indexing_hist():
fig, axes = plt.subplots()
axes.hist(ser_2)


@cleanup
def test_axis_set_tick_params_labelsize_labelcolor():
# Tests fix for issue 4346
Expand All @@ -4225,6 +4228,58 @@ def test_axis_set_tick_params_labelsize_labelcolor():
assert axis_1.yaxis.majorTicks[0]._labelsize == 30.0
assert axis_1.yaxis.majorTicks[0]._labelcolor == 'red'


@image_comparison(baseline_images=['date_timezone_x'], 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)]

# Same Timezone
fig = plt.figure(figsize=(20, 12))
plt.subplot(2, 1, 1)
plt.plot_date(time_index, [3] * 3, tz='Canada/Eastern')

# Different Timezone
plt.subplot(2, 1, 2)
plt.plot_date(time_index, [3] * 3, tz='UTC')


@image_comparison(baseline_images=['date_timezone_y'],
extensions=['png'])
def test_date_timezone_y():
# 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)]

# Same Timezone
fig = plt.figure(figsize=(20, 12))
plt.subplot(2, 1, 1)
plt.plot_date([3] * 3,
time_index, tz='Canada/Eastern', xdate=False, ydate=True)

# Different Timezone
plt.subplot(2, 1, 2)
plt.plot_date([3] * 3, time_index, tz='UTC', xdate=False, ydate=True)


@image_comparison(baseline_images=['date_timezone_x_and_y'],
extensions=['png'])
def test_date_timezone_x_and_y():
# Tests issue 5575
time_index = [pytz.timezone('UTC').localize(datetime.datetime(
year=2016, month=2, day=22, hour=x)) for x in range(3)]

# Same Timezone
fig = plt.figure(figsize=(20, 12))
plt.subplot(2, 1, 1)
plt.plot_date(time_index, time_index, tz='UTC', ydate=True)

# Different Timezone
plt.subplot(2, 1, 2)
plt.plot_date(time_index, time_index, tz='US/Eastern', ydate=True)


if __name__ == '__main__':
import nose
import sys
Expand Down
0