File tree 8 files changed +34
-16
lines changed
8 files changed +34
-16
lines changed Original file line number Diff line number Diff line change 12
12
from pandas import options
13
13
import pandas as pd
14
14
np.set_printoptions(precision = 4 , suppress = True )
15
- options.display.mpl_style= ' default'
15
+ import matplotlib
16
+ try :
17
+ matplotlib.style.use(' ggplot' )
18
+ except AttributeError :
19
+ options.display.mpl_style = ' default'
16
20
options.display.max_rows= 15
17
21
18
22
# ### portions of this were borrowed from the
@@ -695,8 +699,6 @@ Plotting
695
699
696
700
import matplotlib.pyplot as plt
697
701
plt.close(' all' )
698
- from pandas import options
699
- options.display.mpl_style= ' default'
700
702
701
703
.. ipython :: python
702
704
Original file line number Diff line number Diff line change 13
13
from pandas import *
14
14
import pandas as pd
15
15
np.set_printoptions(precision = 4 , suppress = True )
16
- options.display.mpl_style= ' default'
17
16
options.display.max_rows= 15
18
17
19
18
Original file line number Diff line number Diff line change 10
10
import pandas.util.testing as tm
11
11
randn = np.random.randn
12
12
np.set_printoptions(precision = 4 , suppress = True )
13
+ import matplotlib
14
+ try :
15
+ matplotlib.style.use(' ggplot' )
16
+ except AttributeError :
17
+ options.display.mpl_style = ' default'
13
18
import matplotlib.pyplot as plt
14
19
plt.close(' all' )
15
- options.display.mpl_style= ' default'
16
20
options.display.max_rows= 15
17
21
18
22
Computational tools
Original file line number Diff line number Diff line change 17
17
np.random.seed(123456 )
18
18
19
19
pd.options.display.max_rows= 15
20
- pd.options.display.mpl_style= ' default'
20
+
21
+ import matplotlib
22
+ try :
23
+ matplotlib.style.use(' ggplot' )
24
+ except AttributeError :
25
+ pd.options.display.mpl_style = ' default'
21
26
22
27
np.set_printoptions(precision = 4 , suppress = True )
23
28
Original file line number Diff line number Diff line change @@ -21,7 +21,11 @@ Frequently Asked Questions (FAQ)
21
21
from pandas.tseries.offsets import *
22
22
import matplotlib.pyplot as plt
23
23
plt.close(' all' )
24
- options.display.mpl_style= ' default'
24
+ import matplotlib
25
+ try :
26
+ matplotlib.style.use(' ggplot' )
27
+ except AttributeError :
28
+ options.display.mpl_style = ' default'
25
29
from pandas.compat import lrange
26
30
27
31
Original file line number Diff line number Diff line change 12
12
np.set_printoptions(precision = 4 , suppress = True )
13
13
import matplotlib.pyplot as plt
14
14
plt.close(' all' )
15
- options.display.mpl_style= ' default'
15
+ import matplotlib
16
+ try :
17
+ matplotlib.style.use(' ggplot' )
18
+ except AttributeError :
19
+ options.display.mpl_style = ' default'
16
20
from pandas.compat import zip
17
21
18
22
*****************************
@@ -346,7 +350,7 @@ A single group can be selected using ``GroupBy.get_group()``:
346
350
.. ipython :: python
347
351
348
352
grouped.get_group(' bar' )
349
-
353
+
350
354
Or for an object grouped on multiple columns:
351
355
352
356
.. ipython :: python
Original file line number Diff line number Diff line change 10
10
import pandas.util.testing as tm
11
11
randn = np.random.randn
12
12
np.set_printoptions(precision = 4 , suppress = True )
13
- import matplotlib.pyplot as plt
14
- plt.close(' all' )
15
- options.display.mpl_style= ' default'
16
13
options.display.max_rows = 15
17
14
18
15
**********************
@@ -222,4 +219,3 @@ row and columns coordinates of the matrix. Note that this will consume a signifi
222
219
223
220
ss_dense = SparseSeries.from_coo(A, dense_index = True )
224
221
ss_dense
225
-
Original file line number Diff line number Diff line change @@ -31,10 +31,14 @@ We use the standard convention for referencing the matplotlib API:
31
31
32
32
import matplotlib.pyplot as plt
33
33
34
- .. versionadded :: 0.11.0
34
+ The plots in this document are made using matplotlib's `` ggplot `` style (new in version 1.4):
35
35
36
- The plots in this document are made using matplotlib's ``ggplot `` style (new in version 1.4).
37
- If your version of matplotlib is 1.3 or lower, setting the ``display.mpl_style `` to ``'default' ``
36
+ .. code-block :: python
37
+
38
+ import matplotlib
39
+ matplotlib.style.use(' ggplot' )
40
+
41
+ If your version of matplotlib is 1.3 or lower, you can set ``display.mpl_style `` to ``'default' ``
38
42
with ``pd.options.display.mpl_style = 'default' ``
39
43
to produce more appealing plots.
40
44
When set, matplotlib's ``rcParams `` are changed (globally!) to nicer-looking settings.
You can’t perform that action at this time.
0 commit comments