From 7856995a3a68953a317a7225946a8b3f26557299 Mon Sep 17 00:00:00 2001 From: Wieland Hoffmann Date: Mon, 2 Dec 2013 17:47:20 +0100 Subject: [PATCH] plot_date: Set the default fmt to 'o' Different to just plot() plot_date() has a default plot format string which makes it necessary to *unset* the default one when drawing multiple sequences of dates in a figure to get a working color cycling. It also was not exactly clear that Axes.set_color_cycle was setting the color cycle for every plot command except for plot_date ones. It was of course possible to simply unset it after reading the documentation but that's not the path of least suprise. The default fmt of 'o' will keep the markers by default (which makes sense for dates) but allows color cycling to happen. This is related to issue #2148 --- doc/api/api_changes.rst | 3 +++ lib/matplotlib/axes/_axes.py | 2 +- lib/matplotlib/pyplot.py | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/api/api_changes.rst b/doc/api/api_changes.rst index 7f5700ab6a72..76f328f3ecb3 100644 --- a/doc/api/api_changes.rst +++ b/doc/api/api_changes.rst @@ -107,6 +107,9 @@ original location: does the exact same thing as `FormatStrFormatter`, but for new-style formatting strings. +* The ``fmt`` argument of :meth:`~matplotlib.axes.Axes.plot_date` has been + changed from ``bo`` to just ``o``, so color cycling can happen by default. + .. _changes_in_1_3: diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 1b7953c31ce1..756afdaa521b 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -1337,7 +1337,7 @@ def plot(self, *args, **kwargs): return lines @docstring.dedent_interpd - def plot_date(self, x, y, fmt='bo', tz=None, xdate=True, ydate=False, + def plot_date(self, x, y, fmt='o', tz=None, xdate=True, ydate=False, **kwargs): """ Plot with data with dates. diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index a67fc8580b1e..47a038d13201 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -3066,7 +3066,7 @@ def plot(*args, **kwargs): # This function was autogenerated by boilerplate.py. Do not edit as # changes will be lost @_autogen_docstring(Axes.plot_date) -def plot_date(x, y, fmt='bo', tz=None, xdate=True, ydate=False, hold=None, +def plot_date(x, y, fmt='o', tz=None, xdate=True, ydate=False, hold=None, **kwargs): ax = gca() # allow callers to override the hold state by passing hold=True|False