Skip to content

Commit c1997d4

Browse files
topper-123No-Stream
authored andcommitted
DOC: Change plot style to matplotlib default from ggplot (pandas-dev#17462)
1 parent 4cd6825 commit c1997d4

8 files changed

+25
-17
lines changed

doc/source/10min.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
np.random.seed(123456)
1212
np.set_printoptions(precision=4, suppress=True)
1313
import matplotlib
14-
matplotlib.style.use('ggplot')
14+
# matplotlib.style.use('default')
1515
pd.options.display.max_rows = 15
1616
1717
#### portions of this were borrowed from the

doc/source/computation.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
np.set_printoptions(precision=4, suppress=True)
99
import pandas as pd
1010
import matplotlib
11-
matplotlib.style.use('ggplot')
11+
# matplotlib.style.use('default')
1212
import matplotlib.pyplot as plt
1313
plt.close('all')
1414
pd.options.display.max_rows=15

doc/source/cookbook.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
pd.options.display.max_rows=15
2121
2222
import matplotlib
23-
matplotlib.style.use('ggplot')
23+
# matplotlib.style.use('default')
2424
2525
np.set_printoptions(precision=4, suppress=True)
2626

doc/source/dsintro.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
pd.options.display.max_rows = 15
1111
1212
import matplotlib
13-
matplotlib.style.use('ggplot')
13+
# matplotlib.style.use('default')
1414
import matplotlib.pyplot as plt
1515
plt.close('all')
1616

doc/source/gotchas.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Frequently Asked Questions (FAQ)
1414
import pandas as pd
1515
pd.options.display.max_rows = 15
1616
import matplotlib
17-
matplotlib.style.use('ggplot')
17+
# matplotlib.style.use('default')
1818
import matplotlib.pyplot as plt
1919
plt.close('all')
2020

doc/source/groupby.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import pandas as pd
1111
pd.options.display.max_rows = 15
1212
import matplotlib
13-
matplotlib.style.use('ggplot')
13+
# matplotlib.style.use('default')
1414
import matplotlib.pyplot as plt
1515
plt.close('all')
1616
from collections import OrderedDict

doc/source/missing_data.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import pandas as pd
88
pd.options.display.max_rows=15
99
import matplotlib
10-
matplotlib.style.use('ggplot')
10+
# matplotlib.style.use('default')
1111
import matplotlib.pyplot as plt
1212
1313
.. _missing_data:

doc/source/visualization.rst

+18-10
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
np.set_printoptions(precision=4, suppress=True)
1111
pd.options.display.max_rows = 15
1212
import matplotlib
13-
matplotlib.style.use('ggplot')
13+
# matplotlib.style.use('default')
1414
import matplotlib.pyplot as plt
1515
plt.close('all')
1616
@@ -24,13 +24,6 @@ We use the standard convention for referencing the matplotlib API:
2424
2525
import matplotlib.pyplot as plt
2626
27-
The plots in this document are made using matplotlib's ``ggplot`` style (new in version 1.4):
28-
29-
.. code-block:: python
30-
31-
import matplotlib
32-
matplotlib.style.use('ggplot')
33-
3427
We provide the basics in pandas to easily create decent looking plots.
3528
See the :ref:`ecosystem <ecosystem.visualization>` section for visualization
3629
libraries that go beyond the basics documented here.
@@ -134,7 +127,7 @@ For example, a bar plot can be created the following way:
134127
plt.figure();
135128
136129
@savefig bar_plot_ex.png
137-
df.iloc[5].plot(kind='bar'); plt.axhline(0, color='k')
130+
df.iloc[5].plot(kind='bar');
138131
139132
.. versionadded:: 0.17.0
140133

@@ -154,7 +147,7 @@ and :ref:`DataFrame.boxplot() <visualization.box>` methods, which use a separate
154147

155148
Finally, there are several :ref:`plotting functions <visualization.tools>` in ``pandas.plotting``
156149
that take a :class:`Series` or :class:`DataFrame` as an argument. These
157-
include
150+
include:
158151

159152
* :ref:`Scatter Matrix <visualization.scatter_matrix>`
160153
* :ref:`Andrews Curves <visualization.andrews_curves>`
@@ -1049,6 +1042,21 @@ be colored differently.
10491042
Plot Formatting
10501043
---------------
10511044

1045+
Setting the plot style
1046+
~~~~~~~~~~~~~~~~~~~~~~
1047+
1048+
From version 1.5 and up, matplotlib offers a range of preconfigured plotting styles. Setting the
1049+
style can be used to easily give plots the general look that you want.
1050+
Setting the style is as easy as calling ``matplotlib.style.use(my_plot_style)`` before
1051+
creating your plot. For example you could do ``matplotlib.style.use('ggplot')`` for ggplot-style
1052+
plots.
1053+
1054+
You can see the various available style names at ``matplotlib.style.available`` and it's very
1055+
easy to try them out.
1056+
1057+
General plot style arguments
1058+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1059+
10521060
Most plotting methods have a set of keyword arguments that control the
10531061
layout and formatting of the returned plot:
10541062

0 commit comments

Comments
 (0)