Skip to content

Commit 7856995

Browse files
committed
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 matplotlib#2148
1 parent c0e5c99 commit 7856995

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

doc/api/api_changes.rst

+3
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ original location:
107107
does the exact same thing as `FormatStrFormatter`, but for new-style
108108
formatting strings.
109109

110+
* The ``fmt`` argument of :meth:`~matplotlib.axes.Axes.plot_date` has been
111+
changed from ``bo`` to just ``o``, so color cycling can happen by default.
112+
110113
.. _changes_in_1_3:
111114

112115

lib/matplotlib/axes/_axes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1337,7 +1337,7 @@ def plot(self, *args, **kwargs):
13371337
return lines
13381338

13391339
@docstring.dedent_interpd
1340-
def plot_date(self, x, y, fmt='bo', tz=None, xdate=True, ydate=False,
1340+
def plot_date(self, x, y, fmt='o', tz=None, xdate=True, ydate=False,
13411341
**kwargs):
13421342
"""
13431343
Plot with data with dates.

lib/matplotlib/pyplot.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3066,7 +3066,7 @@ def plot(*args, **kwargs):
30663066
# This function was autogenerated by boilerplate.py. Do not edit as
30673067
# changes will be lost
30683068
@_autogen_docstring(Axes.plot_date)
3069-
def plot_date(x, y, fmt='bo', tz=None, xdate=True, ydate=False, hold=None,
3069+
def plot_date(x, y, fmt='o', tz=None, xdate=True, ydate=False, hold=None,
30703070
**kwargs):
30713071
ax = gca()
30723072
# allow callers to override the hold state by passing hold=True|False

0 commit comments

Comments
 (0)