Skip to content

Commit dc99dc6

Browse files
committed
Plot fix for tdi and added more comments.
1 parent 9b348a4 commit dc99dc6

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

pandas/tseries/plotting.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ def format_dateaxis(subplot, freq, index):
296296
the positions of the ticks.
297297
"""
298298

299+
# handle index specific formatting
299300
if isinstance(index, PeriodIndex):
300301

301302
majlocator = TimeSeries_DateLocator(freq, dynamic_mode=True,
@@ -316,15 +317,18 @@ def format_dateaxis(subplot, freq, index):
316317
subplot.xaxis.set_major_formatter(majformatter)
317318
subplot.xaxis.set_minor_formatter(minformatter)
318319

319-
# x and y coord info
320-
subplot.format_coord = lambda t, y: (
321-
"t = {0} y = {1:8f}".format(Period(ordinal=int(t), freq=freq), y))
322-
323-
pylab.draw_if_interactive()
324-
325320
elif isinstance(index, TimedeltaIndex):
326321
from matplotlib import ticker
327322
formatter = ticker.FuncFormatter(timeTicks)
328323
subplot.xaxis.set_major_formatter(formatter)
329324
else:
330325
raise IOError('index type not supported')
326+
327+
# Note, DatetimeIndex does not use this
328+
# interface. DatetimeIndex uses matplotlib.date directly
329+
330+
# x and y coord info
331+
subplot.format_coord = lambda t, y: (
332+
"t = {0} y = {1:8f}".format(Period(ordinal=int(t), freq=freq), y))
333+
334+
pylab.draw_if_interactive()

0 commit comments

Comments
 (0)