From 6212b797bd42a6277e6b3f700f86d1fb6ece3fc3 Mon Sep 17 00:00:00 2001 From: tp Date: Thu, 7 Sep 2017 12:33:55 +0100 Subject: [PATCH 1/4] Change plot style to seaborn from ggplot --- doc/source/10min.rst | 2 +- doc/source/computation.rst | 2 +- doc/source/cookbook.rst | 2 +- doc/source/dsintro.rst | 2 +- doc/source/gotchas.rst | 2 +- doc/source/groupby.rst | 2 +- doc/source/missing_data.rst | 2 +- doc/source/visualization.rst | 20 ++++++++++++++++---- 8 files changed, 23 insertions(+), 11 deletions(-) diff --git a/doc/source/10min.rst b/doc/source/10min.rst index ef6b2d6ef2c90..37d42d6153895 100644 --- a/doc/source/10min.rst +++ b/doc/source/10min.rst @@ -11,7 +11,7 @@ np.random.seed(123456) np.set_printoptions(precision=4, suppress=True) import matplotlib - matplotlib.style.use('ggplot') + matplotlib.style.use('seaborn') pd.options.display.max_rows = 15 #### portions of this were borrowed from the diff --git a/doc/source/computation.rst b/doc/source/computation.rst index 23699393958cf..ce2dc90d54497 100644 --- a/doc/source/computation.rst +++ b/doc/source/computation.rst @@ -8,7 +8,7 @@ np.set_printoptions(precision=4, suppress=True) import pandas as pd import matplotlib - matplotlib.style.use('ggplot') + matplotlib.style.use('seaborn') import matplotlib.pyplot as plt plt.close('all') pd.options.display.max_rows=15 diff --git a/doc/source/cookbook.rst b/doc/source/cookbook.rst index 5bb3ba75fe51b..b0fdefb88b0e1 100644 --- a/doc/source/cookbook.rst +++ b/doc/source/cookbook.rst @@ -20,7 +20,7 @@ pd.options.display.max_rows=15 import matplotlib - matplotlib.style.use('ggplot') + matplotlib.style.use('seaborn') np.set_printoptions(precision=4, suppress=True) diff --git a/doc/source/dsintro.rst b/doc/source/dsintro.rst index ec0a1c7a00bf7..49108256749dc 100644 --- a/doc/source/dsintro.rst +++ b/doc/source/dsintro.rst @@ -10,7 +10,7 @@ pd.options.display.max_rows = 15 import matplotlib - matplotlib.style.use('ggplot') + matplotlib.style.use('seaborn') import matplotlib.pyplot as plt plt.close('all') diff --git a/doc/source/gotchas.rst b/doc/source/gotchas.rst index 9e6f98923fca6..22cdb9d2d3225 100644 --- a/doc/source/gotchas.rst +++ b/doc/source/gotchas.rst @@ -14,7 +14,7 @@ Frequently Asked Questions (FAQ) import pandas as pd pd.options.display.max_rows = 15 import matplotlib - matplotlib.style.use('ggplot') + matplotlib.style.use('seaborn') import matplotlib.pyplot as plt plt.close('all') diff --git a/doc/source/groupby.rst b/doc/source/groupby.rst index e1231b9a4a200..6fa03b6e88a2e 100644 --- a/doc/source/groupby.rst +++ b/doc/source/groupby.rst @@ -10,7 +10,7 @@ import pandas as pd pd.options.display.max_rows = 15 import matplotlib - matplotlib.style.use('ggplot') + matplotlib.style.use('seaborn') import matplotlib.pyplot as plt plt.close('all') from collections import OrderedDict diff --git a/doc/source/missing_data.rst b/doc/source/missing_data.rst index 65b411ccd4af2..8a536f5a2e61a 100644 --- a/doc/source/missing_data.rst +++ b/doc/source/missing_data.rst @@ -7,7 +7,7 @@ import pandas as pd pd.options.display.max_rows=15 import matplotlib - matplotlib.style.use('ggplot') + matplotlib.style.use('seaborn') import matplotlib.pyplot as plt .. _missing_data: diff --git a/doc/source/visualization.rst b/doc/source/visualization.rst index b5a261e3acac5..90a946c0ab94e 100644 --- a/doc/source/visualization.rst +++ b/doc/source/visualization.rst @@ -10,7 +10,7 @@ np.set_printoptions(precision=4, suppress=True) pd.options.display.max_rows = 15 import matplotlib - matplotlib.style.use('ggplot') + matplotlib.style.use('seaborn') import matplotlib.pyplot as plt plt.close('all') @@ -24,12 +24,12 @@ We use the standard convention for referencing the matplotlib API: import matplotlib.pyplot as plt -The plots in this document are made using matplotlib's ``ggplot`` style (new in version 1.4): +The plots in this document are made using matplotlib's ``seaborn`` style (new in version 1.5): .. code-block:: python import matplotlib - matplotlib.style.use('ggplot') + matplotlib.style.use('seaborn') We provide the basics in pandas to easily create decent looking plots. See the :ref:`ecosystem ` section for visualization @@ -134,7 +134,7 @@ For example, a bar plot can be created the following way: plt.figure(); @savefig bar_plot_ex.png - df.iloc[5].plot(kind='bar'); plt.axhline(0, color='k') + df.iloc[5].plot(kind='bar'); .. versionadded:: 0.17.0 @@ -1049,6 +1049,18 @@ be colored differently. Plot Formatting --------------- +Setting the plot style +~~~~~~~~~~~~~~~~~~~~~~~~ + +From version 1.5 and up, matplotlib offers a range of preconfigured plotting style. Setting the +style can be used to easily give the plots the general look that you want. +Setting the style is as easy as calling ``matplotlib.style.use(my_plot_style)`` before +creating your plot. For example you could do ``matplotlib.style.use('ggplot')`` for ggplot-style +plots. + +You can see the various available style names at ``matplotlib.style.available`` and it's very +easy to try them out. + Most plotting methods have a set of keyword arguments that control the layout and formatting of the returned plot: From e58e5c7621a6b661c0db9cdf16281b9be27e8dc3 Mon Sep 17 00:00:00 2001 From: topper-123 Date: Mon, 11 Sep 2017 15:20:06 +0100 Subject: [PATCH 2/4] minor language improvements --- doc/source/visualization.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/visualization.rst b/doc/source/visualization.rst index 90a946c0ab94e..6b4a318b34acb 100644 --- a/doc/source/visualization.rst +++ b/doc/source/visualization.rst @@ -1052,8 +1052,8 @@ Plot Formatting Setting the plot style ~~~~~~~~~~~~~~~~~~~~~~~~ -From version 1.5 and up, matplotlib offers a range of preconfigured plotting style. Setting the -style can be used to easily give the plots the general look that you want. +From version 1.5 and up, matplotlib offers a range of preconfigured plotting styles. Setting the +style can be used to easily give plots the general look that you want. Setting the style is as easy as calling ``matplotlib.style.use(my_plot_style)`` before creating your plot. For example you could do ``matplotlib.style.use('ggplot')`` for ggplot-style plots. From 3f56b60e26adb61a7c46d60c2496cebfabd11c48 Mon Sep 17 00:00:00 2001 From: tp Date: Sun, 24 Sep 2017 23:15:19 +0200 Subject: [PATCH 3/4] Changed documenation plots to 'default' style --- doc/source/10min.rst | 2 +- doc/source/computation.rst | 2 +- doc/source/cookbook.rst | 2 +- doc/source/dsintro.rst | 2 +- doc/source/gotchas.rst | 2 +- doc/source/groupby.rst | 2 +- doc/source/missing_data.rst | 2 +- doc/source/visualization.rst | 11 ++--------- 8 files changed, 9 insertions(+), 16 deletions(-) diff --git a/doc/source/10min.rst b/doc/source/10min.rst index 37d42d6153895..0a23f490e6628 100644 --- a/doc/source/10min.rst +++ b/doc/source/10min.rst @@ -11,7 +11,7 @@ np.random.seed(123456) np.set_printoptions(precision=4, suppress=True) import matplotlib - matplotlib.style.use('seaborn') + # matplotlib.style.use('default') pd.options.display.max_rows = 15 #### portions of this were borrowed from the diff --git a/doc/source/computation.rst b/doc/source/computation.rst index ce2dc90d54497..97472ca4dd938 100644 --- a/doc/source/computation.rst +++ b/doc/source/computation.rst @@ -8,7 +8,7 @@ np.set_printoptions(precision=4, suppress=True) import pandas as pd import matplotlib - matplotlib.style.use('seaborn') + # matplotlib.style.use('default') import matplotlib.pyplot as plt plt.close('all') pd.options.display.max_rows=15 diff --git a/doc/source/cookbook.rst b/doc/source/cookbook.rst index b0fdefb88b0e1..f13e5e67de07e 100644 --- a/doc/source/cookbook.rst +++ b/doc/source/cookbook.rst @@ -20,7 +20,7 @@ pd.options.display.max_rows=15 import matplotlib - matplotlib.style.use('seaborn') + # matplotlib.style.use('default') np.set_printoptions(precision=4, suppress=True) diff --git a/doc/source/dsintro.rst b/doc/source/dsintro.rst index 49108256749dc..e5c7637ddb499 100644 --- a/doc/source/dsintro.rst +++ b/doc/source/dsintro.rst @@ -10,7 +10,7 @@ pd.options.display.max_rows = 15 import matplotlib - matplotlib.style.use('seaborn') + # matplotlib.style.use('default') import matplotlib.pyplot as plt plt.close('all') diff --git a/doc/source/gotchas.rst b/doc/source/gotchas.rst index 22cdb9d2d3225..8ae830d7fd76b 100644 --- a/doc/source/gotchas.rst +++ b/doc/source/gotchas.rst @@ -14,7 +14,7 @@ Frequently Asked Questions (FAQ) import pandas as pd pd.options.display.max_rows = 15 import matplotlib - matplotlib.style.use('seaborn') + # matplotlib.style.use('default') import matplotlib.pyplot as plt plt.close('all') diff --git a/doc/source/groupby.rst b/doc/source/groupby.rst index 6fa03b6e88a2e..ddc7d7fcd2ff1 100644 --- a/doc/source/groupby.rst +++ b/doc/source/groupby.rst @@ -10,7 +10,7 @@ import pandas as pd pd.options.display.max_rows = 15 import matplotlib - matplotlib.style.use('seaborn') + # matplotlib.style.use('default') import matplotlib.pyplot as plt plt.close('all') from collections import OrderedDict diff --git a/doc/source/missing_data.rst b/doc/source/missing_data.rst index 8a536f5a2e61a..1fffb2963b7ca 100644 --- a/doc/source/missing_data.rst +++ b/doc/source/missing_data.rst @@ -7,7 +7,7 @@ import pandas as pd pd.options.display.max_rows=15 import matplotlib - matplotlib.style.use('seaborn') + # matplotlib.style.use('default') import matplotlib.pyplot as plt .. _missing_data: diff --git a/doc/source/visualization.rst b/doc/source/visualization.rst index 6b4a318b34acb..dc02f2cce1aed 100644 --- a/doc/source/visualization.rst +++ b/doc/source/visualization.rst @@ -10,7 +10,7 @@ np.set_printoptions(precision=4, suppress=True) pd.options.display.max_rows = 15 import matplotlib - matplotlib.style.use('seaborn') + # matplotlib.style.use('default') import matplotlib.pyplot as plt plt.close('all') @@ -24,13 +24,6 @@ We use the standard convention for referencing the matplotlib API: import matplotlib.pyplot as plt -The plots in this document are made using matplotlib's ``seaborn`` style (new in version 1.5): - -.. code-block:: python - - import matplotlib - matplotlib.style.use('seaborn') - We provide the basics in pandas to easily create decent looking plots. See the :ref:`ecosystem ` section for visualization libraries that go beyond the basics documented here. @@ -154,7 +147,7 @@ and :ref:`DataFrame.boxplot() ` methods, which use a separate Finally, there are several :ref:`plotting functions ` in ``pandas.plotting`` that take a :class:`Series` or :class:`DataFrame` as an argument. These -include +include: * :ref:`Scatter Matrix ` * :ref:`Andrews Curves ` From 2fec328eaef38535b5042f9b8d2cce0f7f733fb0 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Mon, 25 Sep 2017 09:32:35 +0200 Subject: [PATCH 4/4] add title --- doc/source/visualization.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/source/visualization.rst b/doc/source/visualization.rst index dc02f2cce1aed..bed83758ee2ff 100644 --- a/doc/source/visualization.rst +++ b/doc/source/visualization.rst @@ -1043,7 +1043,7 @@ Plot Formatting --------------- Setting the plot style -~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~ From version 1.5 and up, matplotlib offers a range of preconfigured plotting styles. Setting the style can be used to easily give plots the general look that you want. @@ -1054,6 +1054,9 @@ plots. You can see the various available style names at ``matplotlib.style.available`` and it's very easy to try them out. +General plot style arguments +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Most plotting methods have a set of keyword arguments that control the layout and formatting of the returned plot: