12
12
np.set_printoptions(precision = 4 , suppress = True )
13
13
import matplotlib.pyplot as plt
14
14
tips_data = read_csv(' data/tips.csv' )
15
+ iris_data = read_csv(' data/iris.data' )
15
16
from pandas import read_csv
16
17
from pandas.tools.plotting import radviz
17
18
import pandas.tools.rplot as rplot
21
22
Trellis plotting interface
22
23
**************************
23
24
25
+ RPlot is a flexible API for producing Trellis plots. These plots allow you to arrange data in a rectangular grid by values of certain attributes.
26
+
24
27
.. ipython :: python
25
28
26
29
plt.figure()
@@ -29,7 +32,7 @@ Trellis plotting interface
29
32
plot.add(rplot.TrellisGrid([' sex' , ' smoker' ]))
30
33
plot.add(rplot.GeomHistogram())
31
34
32
- @savefig rplot1_tips.png width =6in
35
+ @savefig rplot1_tips.png width =8in
33
36
plot.render(plt.gcf())
34
37
35
38
.. ipython :: python
@@ -40,5 +43,66 @@ Trellis plotting interface
40
43
plot.add(rplot.TrellisGrid([' sex' , ' smoker' ]))
41
44
plot.add(rplot.GeomDensity())
42
45
43
- @savefig rplot2_tips.png width =6in
44
- plot.render(plt.gcf())
46
+ @savefig rplot2_tips.png width =8in
47
+ plot.render(plt.gcf())
48
+
49
+ .. ipython :: python
50
+
51
+ plt.figure()
52
+
53
+ plot = rplot.RPlot(tips_data, x = ' totbill' , y = ' tip' )
54
+ plot.add(rplot.TrellisGrid([' sex' , ' smoker' ]))
55
+ plot.add(rplot.GeomScatter())
56
+ plot.add(rplot.GeomPolyFit(degree = 2 ))
57
+
58
+ @savefig rplot3_tips.png width =8in
59
+ plot.render(plt.gcf())
60
+
61
+ .. ipython :: python
62
+
63
+ plt.figure()
64
+
65
+ plot = rplot.RPlot(tips_data, x = ' totbill' , y = ' tip' )
66
+ plot.add(rplot.TrellisGrid([' sex' , ' smoker' ]))
67
+ plot.add(rplot.GeomScatter())
68
+ plot.add(rplot.GeomDensity2D())
69
+
70
+ @savefig rplot4_tips.png width =8in
71
+ plot.render(plt.gcf())
72
+
73
+ .. ipython :: python
74
+
75
+ plt.figure()
76
+
77
+ plot = rplot.RPlot(tips_data, x = ' totbill' , y = ' tip' )
78
+ plot.add(rplot.TrellisGrid([' sex' , ' .' ]))
79
+ plot.add(rplot.GeomHistogram())
80
+
81
+ @savefig rplot5_tips.png width =8in
82
+ plot.render(plt.gcf())
83
+
84
+ .. ipython :: python
85
+
86
+ plt.figure()
87
+
88
+ plot = rplot.RPlot(tips_data, x = ' totbill' , y = ' tip' )
89
+ plot.add(rplot.TrellisGrid([' .' , ' smoker' ]))
90
+ plot.add(rplot.GeomHistogram())
91
+
92
+ @savefig rplot6_tips.png width =8in
93
+ plot.render(plt.gcf())
94
+
95
+ .. ipython :: python
96
+
97
+ plt.figure()
98
+
99
+ plot = rplot.RPlot(tips_data, x = ' totbill' , y = ' tip' )
100
+ plot.add(rplot.TrellisGrid([' .' , ' smoker' ]))
101
+ plot.add(rplot.GeomHistogram())
102
+
103
+ plot = rplot.RPlot(tips_data, x = ' tip' , y = ' totbill' )
104
+ plot.add(rplot.TrellisGrid([' sex' , ' smoker' ]))
105
+ plot.add(rplot.GeomPoint(size = 80.0 , colour = rplot.ScaleRandomColour(' day' ), shape = rplot.ScaleShape(' size' ), alpha = 1.0 ))
106
+
107
+ @savefig rplot7_tips.png width =8in
108
+ plot.render(plt.gcf())
0 commit comments