Skip to content

Commit cfefe13

Browse files
committed
Added rplot examples to doc
1 parent 54a68d7 commit cfefe13

File tree

1 file changed

+67
-3
lines changed

1 file changed

+67
-3
lines changed

doc/source/rplot.rst

Lines changed: 67 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
np.set_printoptions(precision=4, suppress=True)
1313
import matplotlib.pyplot as plt
1414
tips_data = read_csv('data/tips.csv')
15+
iris_data = read_csv('data/iris.data')
1516
from pandas import read_csv
1617
from pandas.tools.plotting import radviz
1718
import pandas.tools.rplot as rplot
@@ -21,6 +22,8 @@
2122
Trellis plotting interface
2223
**************************
2324

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+
2427
.. ipython:: python
2528
2629
plt.figure()
@@ -29,7 +32,7 @@ Trellis plotting interface
2932
plot.add(rplot.TrellisGrid(['sex', 'smoker']))
3033
plot.add(rplot.GeomHistogram())
3134
32-
@savefig rplot1_tips.png width=6in
35+
@savefig rplot1_tips.png width=8in
3336
plot.render(plt.gcf())
3437
3538
.. ipython:: python
@@ -40,5 +43,66 @@ Trellis plotting interface
4043
plot.add(rplot.TrellisGrid(['sex', 'smoker']))
4144
plot.add(rplot.GeomDensity())
4245
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

Comments
 (0)