10
10
np.set_printoptions(precision = 4 , suppress = True )
11
11
pd.options.display.max_rows = 15
12
12
import matplotlib
13
- matplotlib.style.use(' ggplot ' )
13
+ # matplotlib.style.use('default ')
14
14
import matplotlib.pyplot as plt
15
15
plt.close(' all' )
16
16
@@ -24,13 +24,6 @@ We use the standard convention for referencing the matplotlib API:
24
24
25
25
import matplotlib.pyplot as plt
26
26
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
-
34
27
We provide the basics in pandas to easily create decent looking plots.
35
28
See the :ref: `ecosystem <ecosystem.visualization >` section for visualization
36
29
libraries that go beyond the basics documented here.
@@ -134,7 +127,7 @@ For example, a bar plot can be created the following way:
134
127
plt.figure();
135
128
136
129
@savefig bar_plot_ex.png
137
- df.iloc[5 ].plot(kind = ' bar' ); plt.axhline( 0 , color = ' k ' )
130
+ df.iloc[5 ].plot(kind = ' bar' );
138
131
139
132
.. versionadded :: 0.17.0
140
133
@@ -154,7 +147,7 @@ and :ref:`DataFrame.boxplot() <visualization.box>` methods, which use a separate
154
147
155
148
Finally, there are several :ref: `plotting functions <visualization.tools >` in ``pandas.plotting ``
156
149
that take a :class: `Series ` or :class: `DataFrame ` as an argument. These
157
- include
150
+ include:
158
151
159
152
* :ref: `Scatter Matrix <visualization.scatter_matrix >`
160
153
* :ref: `Andrews Curves <visualization.andrews_curves >`
@@ -1049,6 +1042,21 @@ be colored differently.
1049
1042
Plot Formatting
1050
1043
---------------
1051
1044
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
+
1052
1060
Most plotting methods have a set of keyword arguments that control the
1053
1061
layout and formatting of the returned plot:
1054
1062
0 commit comments