diff --git a/doc/source/whatsnew/v1.0.0.rst b/doc/source/whatsnew/v1.0.0.rst index 2eec87b0de4e95..fa562838c8f7ca 100755 --- a/doc/source/whatsnew/v1.0.0.rst +++ b/doc/source/whatsnew/v1.0.0.rst @@ -1090,7 +1090,6 @@ Plotting - Bug in color validation incorrectly raising for non-color styles (:issue:`29122`). - Allow :meth:`DataFrame.plot.scatter` to plot ``objects`` and ``datetime`` type data (:issue:`18755`, :issue:`30391`) - Bug in :meth:`DataFrame.hist`, ``xrot=0`` does not work with ``by`` and subplots (:issue:`30288`). -- :func:`.plot` for line/bar now accepts color by dictonary (:issue:`8193`). Groupby/resample/rolling ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/doc/source/whatsnew/v1.1.0.rst b/doc/source/whatsnew/v1.1.0.rst index b5a7b19f160a4a..3089da2a1d4f07 100644 --- a/doc/source/whatsnew/v1.1.0.rst +++ b/doc/source/whatsnew/v1.1.0.rst @@ -127,7 +127,7 @@ I/O Plotting ^^^^^^^^ -- +- :func:`.plot` for line/bar now accepts color by dictonary (:issue:`8193`). - Groupby/resample/rolling diff --git a/pandas/plotting/_core.py b/pandas/plotting/_core.py index 68156245f47018..5fdf9151aacb42 100644 --- a/pandas/plotting/_core.py +++ b/pandas/plotting/_core.py @@ -865,20 +865,20 @@ def line(self, x=None, y=None, **kwargs): Either the location or the label of the columns to be used. By default, it will use the remaining DataFrame numeric columns. color : str, int, array_like, or dict, optional - The color of each line for each row. Possible values are: + The color for each of the DataFrame's columns. Possible values are: - A single color string referred to by name, RGB or RGBA code, for instance 'red' or '#a98d19'. - A sequence of color strings referred to by name, RGB or RGBA - code, which will be used for each line for each row recursively. For - instance ['green','yellow'] all lines for each row will be filled in green - or yellow, alternatively. + code, which will be used for each column recursively. For + instance ['green','yellow'] each column's line will be coloured in + green or yellow, alternatively. - - A dict of the form {column name : color}, so that each row's lines will be + - A dict of the form {column name : color}, so that each column will be colored accordingly. For example, if your columns are called `a` and `b`, - then passing {'a': 'green', 'b': 'red'} will color the lines for column - `a` in green and lines for column `b` in red. + then passing {'a': 'green', 'b': 'red'} will color lines for column `a` in + green and lines for column `b` in red. **kwargs Keyword arguments to pass on to :meth:`DataFrame.plot`. @@ -960,17 +960,17 @@ def bar(self, x=None, y=None, **kwargs): Allows plotting of one column versus another. If not specified, all numerical columns are used. color : str, int, array_like, or dict, optional - The color of each bar for each row. Possible values are: + The color for each of the DataFrame's columns. Possible values are: - A single color string referred to by name, RGB or RGBA code, for instance 'red' or '#a98d19'. - A sequence of color strings referred to by name, RGB or RGBA - code, which will be used for each bar for each row recursively. For - instance ['green','yellow'] all bars for each row will be filled in green - or yellow, alternatively. + code, which will be used for each column recursively. For + instance ['green','yellow'] each column's bar will be filled in + green or yellow, alternatively. - - A dict of the form {column name : color}, so that each row's bars will be + - A dict of the form {column name : color}, so that each column will be colored accordingly. For example, if your columns are called `a` and `b`, then passing {'a': 'green', 'b': 'red'} will color bars for column `a` in green and bars for column `b` in red. @@ -1025,7 +1025,7 @@ def bar(self, x=None, y=None, **kwargs): >>> axes = df.plot.bar(rot=0, subplots=True) >>> axes[1].legend(loc=2) # doctest: +SKIP - If we don't like the default colours, we can specify how we'd + If you don't like the default colours, you can specify how you'd like each column to be colored. .. plot:: @@ -1069,17 +1069,17 @@ def barh(self, x=None, y=None, **kwargs): y : label or position, default All numeric columns in dataframe Columns to be plotted from the DataFrame. color : str, int, array_like, or dict, optional - The color of each bar for each row. Possible values are: + The color for each of the DataFrame's columns. Possible values are: - A single color string referred to by name, RGB or RGBA code, for instance 'red' or '#a98d19'. - A sequence of color strings referred to by name, RGB or RGBA - code, which will be used for each bar for each row recursively. For - instance ['green','yellow'] all bars for each row will be filled in green - or yellow, alternatively. + code, which will be used for each column recursively. For + instance ['green','yellow'] each column's bar will be filled in + green or yellow, alternatively. - - A dict of the form {column name : color}, so that each row's bars will be + - A dict of the form {column name : color}, so that each column will be colored accordingly. For example, if your columns are called `a` and `b`, then passing {'a': 'green', 'b': 'red'} will color bars for column `a` in green and bars for column `b` in red.