|
1 | 1 | # TODO: Use the fact that axis can have units to simplify the process |
2 | 2 |
|
3 | 3 | import functools |
4 | | -import warnings |
5 | 4 |
|
6 | 5 | import numpy as np |
7 | 6 |
|
|
25 | 24 | TimeSeries_DateFormatter, |
26 | 25 | TimeSeries_DateLocator, |
27 | 26 | TimeSeries_TimedeltaFormatter, |
28 | | - register_pandas_matplotlib_converters, |
29 | 27 | ) |
30 | 28 | import pandas.tseries.frequencies as frequencies |
31 | 29 | from pandas.tseries.offsets import DateOffset |
|
34 | 32 | # Plotting functions and monkey patches |
35 | 33 |
|
36 | 34 |
|
37 | | -@register_pandas_matplotlib_converters |
38 | | -def tsplot(series, plotf, ax=None, **kwargs): |
39 | | - """ |
40 | | - Plots a Series on the given Matplotlib axes or the current axes |
41 | | -
|
42 | | - Parameters |
43 | | - ---------- |
44 | | - axes : Axes |
45 | | - series : Series |
46 | | -
|
47 | | - Notes |
48 | | - _____ |
49 | | - Supports same kwargs as Axes.plot |
50 | | -
|
51 | | -
|
52 | | - .. deprecated:: 0.23.0 |
53 | | - Use Series.plot() instead |
54 | | - """ |
55 | | - import matplotlib.pyplot as plt |
56 | | - |
57 | | - warnings.warn( |
58 | | - "'tsplot' is deprecated and will be removed in a " |
59 | | - "future version. Please use Series.plot() instead.", |
60 | | - FutureWarning, |
61 | | - stacklevel=3, |
62 | | - ) |
63 | | - |
64 | | - # Used inferred freq is possible, need a test case for inferred |
65 | | - if ax is None: |
66 | | - ax = plt.gca() |
67 | | - |
68 | | - freq, series = _maybe_resample(series, ax, kwargs) |
69 | | - |
70 | | - # Set ax with freq info |
71 | | - _decorate_axes(ax, freq, kwargs) |
72 | | - ax._plot_data.append((series, plotf, kwargs)) |
73 | | - lines = plotf(ax, series.index._mpl_repr(), series.values, **kwargs) |
74 | | - |
75 | | - # set date formatter, locators and rescale limits |
76 | | - format_dateaxis(ax, ax.freq, series.index) |
77 | | - return lines |
78 | | - |
79 | | - |
80 | 35 | def _maybe_resample(series, ax, kwargs): |
81 | 36 | # resample against axes freq if necessary |
82 | 37 | freq, ax_freq = _get_freq(ax, series) |
|
0 commit comments