Skip to content

Commit e25f65b

Browse files
committed
[TST] Make jpl units instantiated with datetimes consistent with mpl converters
1 parent f64a70e commit e25f65b

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

lib/matplotlib/testing/jpl_units/EpochConverter.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ class EpochConverter(units.ConversionInterface):
1212
classes.
1313
"""
1414

15-
# julian date reference for "Jan 1, 0001" minus 1 day because
16-
# Matplotlib really wants "Jan 0, 0001"
17-
jdRef = 1721425.5 - 1
15+
jdRef = 1721425.5
1816

1917
@staticmethod
2018
def axisinfo(unit, axis):

lib/matplotlib/tests/test_axes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -856,8 +856,8 @@ def test_axvspan_epoch():
856856
units.register()
857857

858858
# generate some data
859-
t0 = units.Epoch("ET", dt=datetime.datetime(2009, 1, 20))
860-
tf = units.Epoch("ET", dt=datetime.datetime(2009, 1, 21))
859+
t0 = units.Epoch("ET", dt=datetime.datetime(2009, 1, 21))
860+
tf = units.Epoch("ET", dt=datetime.datetime(2009, 1, 22))
861861
dt = units.Duration("ET", units.day.convert("sec"))
862862

863863
ax = plt.gca()
@@ -871,8 +871,8 @@ def test_axhspan_epoch():
871871
units.register()
872872

873873
# generate some data
874-
t0 = units.Epoch("ET", dt=datetime.datetime(2009, 1, 20))
875-
tf = units.Epoch("ET", dt=datetime.datetime(2009, 1, 21))
874+
t0 = units.Epoch("ET", dt=datetime.datetime(2009, 1, 21))
875+
tf = units.Epoch("ET", dt=datetime.datetime(2009, 1, 22))
876876
dt = units.Duration("ET", units.day.convert("sec"))
877877

878878
ax = plt.gca()

lib/matplotlib/tests/test_units.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def test_jpl_bar_units():
134134
day = units.Duration("ET", 24.0 * 60.0 * 60.0)
135135
x = [0 * units.km, 1 * units.km, 2 * units.km]
136136
w = [1 * day, 2 * day, 3 * day]
137-
b = units.Epoch("ET", dt=datetime(2009, 4, 25))
137+
b = units.Epoch("ET", dt=datetime(2009, 4, 26))
138138
fig, ax = plt.subplots()
139139
ax.bar(x, w, bottom=b)
140140
ax.set_ylim([b - 1 * day, b + w[-1] + (1.001) * day])
@@ -149,7 +149,7 @@ def test_jpl_barh_units():
149149
day = units.Duration("ET", 24.0 * 60.0 * 60.0)
150150
x = [0 * units.km, 1 * units.km, 2 * units.km]
151151
w = [1 * day, 2 * day, 3 * day]
152-
b = units.Epoch("ET", dt=datetime(2009, 4, 25))
152+
b = units.Epoch("ET", dt=datetime(2009, 4, 26))
153153

154154
fig, ax = plt.subplots()
155155
ax.barh(x, w, left=b)

0 commit comments

Comments
 (0)