diff --git a/doc/api/api_changes/2015-07-13_scatter_color_kwarg.rst b/doc/api/api_changes/2015-07-13_scatter_color_kwarg.rst new file mode 100644 index 000000000000..b93e17abd6a2 --- /dev/null +++ b/doc/api/api_changes/2015-07-13_scatter_color_kwarg.rst @@ -0,0 +1,8 @@ +Deprecated the 'color' keyword argument to scatter +`````````````````````````````````````````````````` + +The ``scatter`` function takes a ``color`` keyword argument, but this argument +is not defined in the documentation, and there was a comment in the code +suggesting it should be deprecated. Thus, the argument has been deprecated and +removed from the examples; instead, users should use the ``c`` keyword argument +to set the color of the scatter points. diff --git a/doc/users/plotting/examples/annotate_text_arrow.py b/doc/users/plotting/examples/annotate_text_arrow.py index 4ed10f99670e..367196b7a4e9 100644 --- a/doc/users/plotting/examples/annotate_text_arrow.py +++ b/doc/users/plotting/examples/annotate_text_arrow.py @@ -13,8 +13,8 @@ x2 = 1. + numpy.random.randn(100) y2 = 1. + numpy.random.randn(100) -ax.scatter(x1, y1, color="r") -ax.scatter(x2, y2, color="g") +ax.scatter(x1, y1, c="r") +ax.scatter(x2, y2, c="g") bbox_props = dict(boxstyle="round", fc="w", ec="0.5", alpha=0.9) ax.text(-2, -2, "Sample A", ha="center", va="center", size=20, diff --git a/examples/pylab_examples/subplots_demo.py b/examples/pylab_examples/subplots_demo.py index dac9e173587b..4b932a677f10 100644 --- a/examples/pylab_examples/subplots_demo.py +++ b/examples/pylab_examples/subplots_demo.py @@ -37,7 +37,7 @@ ax1.plot(x, y) ax1.set_title('Sharing both axes') ax2.scatter(x, y) -ax3.scatter(x, 2 * y ** 2 - 1, color='r') +ax3.scatter(x, 2 * y ** 2 - 1, c='r') # Fine-tune figure; make subplots close to each other and hide x ticks for # all but bottom plot. f.subplots_adjust(hspace=0) @@ -48,7 +48,7 @@ ax1.plot(x, y) ax1.set_title('Sharing x per column, y per row') ax2.scatter(x, y) -ax3.scatter(x, 2 * y ** 2 - 1, color='r') +ax3.scatter(x, 2 * y ** 2 - 1, c='r') ax4.plot(x, 2 * y ** 2 - 1, color='r') # Four axes, returned as a 2-d array diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index a41160789fbd..7758cb242278 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -3672,6 +3672,11 @@ def scatter(self, x, y, s=20, c=None, marker='o', cmap=None, norm=None, # since it isn't, I am giving it low priority. co = kwargs.pop('color', None) if co is not None: + msg = ( + "The 'color' keyword argument to scatter is deprecated, " + "please use 'c' instead." + ) + warnings.warn(msg, mplDeprecation, stacklevel=1) if edgecolors is None: edgecolors = co if facecolors is None: