Permalink
Browse files

cleaned up stata code

  • Loading branch information...
1 parent 62127ae commit d7203efa447c7cb27eb4aa4d5d52bc951e9f1273 @jrnold committed Sep 22, 2012
View
437 R/stata.R

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -42,18 +42,15 @@ p + scale_colour_tableau("greenorange12")
\code{\link{scale_color_excel2003}},
\code{\link{scale_color_few}},
\code{\link{scale_color_solarized}},
- \code{\link{scale_color_stata}},
\code{\link{scale_colour_economist}},
\code{\link{scale_colour_excel10}},
\code{\link{scale_colour_excel2003}},
\code{\link{scale_colour_few}},
\code{\link{scale_colour_solarized}},
- \code{\link{scale_colour_stata}},
\code{\link{scale_fill_economist}},
\code{\link{scale_fill_excel10}},
\code{\link{scale_fill_excel2003}},
\code{\link{scale_fill_few}},
- \code{\link{scale_fill_solarized}},
- \code{\link{scale_fill_stata}}
+ \code{\link{scale_fill_solarized}}
}
View
@@ -30,19 +30,16 @@
\code{\link{scale_color_excel2003}},
\code{\link{scale_color_few}},
\code{\link{scale_color_solarized}},
- \code{\link{scale_color_stata}},
\code{\link{scale_color_tableau}},
\code{\link{scale_colour_excel10}},
\code{\link{scale_colour_excel2003}},
\code{\link{scale_colour_few}},
\code{\link{scale_colour_solarized}},
- \code{\link{scale_colour_stata}},
\code{\link{scale_colour_tableau}},
\code{\link{scale_fill_excel10}},
\code{\link{scale_fill_excel2003}},
\code{\link{scale_fill_few}},
\code{\link{scale_fill_solarized}},
- \code{\link{scale_fill_stata}},
\code{\link{scale_fill_tableau}}
}
View
@@ -29,19 +29,16 @@
\code{\link{scale_color_excel2003}},
\code{\link{scale_color_few}},
\code{\link{scale_color_solarized}},
- \code{\link{scale_color_stata}},
\code{\link{scale_color_tableau}},
\code{\link{scale_colour_economist}},
\code{\link{scale_colour_excel2003}},
\code{\link{scale_colour_few}},
\code{\link{scale_colour_solarized}},
- \code{\link{scale_colour_stata}},
\code{\link{scale_colour_tableau}},
\code{\link{scale_fill_economist}},
\code{\link{scale_fill_excel2003}},
\code{\link{scale_fill_few}},
\code{\link{scale_fill_solarized}},
- \code{\link{scale_fill_stata}},
\code{\link{scale_fill_tableau}}
}
View
@@ -28,19 +28,16 @@
\code{\link{scale_color_excel10}},
\code{\link{scale_color_few}},
\code{\link{scale_color_solarized}},
- \code{\link{scale_color_stata}},
\code{\link{scale_color_tableau}},
\code{\link{scale_colour_economist}},
\code{\link{scale_colour_excel10}},
\code{\link{scale_colour_few}},
\code{\link{scale_colour_solarized}},
- \code{\link{scale_colour_stata}},
\code{\link{scale_colour_tableau}},
\code{\link{scale_fill_economist}},
\code{\link{scale_fill_excel10}},
\code{\link{scale_fill_few}},
\code{\link{scale_fill_solarized}},
- \code{\link{scale_fill_stata}},
\code{\link{scale_fill_tableau}}
}
View
@@ -40,19 +40,16 @@ dsamp <- diamonds[sample(nrow(diamonds), 1000), ]
\code{\link{scale_color_excel10}},
\code{\link{scale_color_excel2003}},
\code{\link{scale_color_solarized}},
- \code{\link{scale_color_stata}},
\code{\link{scale_color_tableau}},
\code{\link{scale_colour_economist}},
\code{\link{scale_colour_excel10}},
\code{\link{scale_colour_excel2003}},
\code{\link{scale_colour_solarized}},
- \code{\link{scale_colour_stata}},
\code{\link{scale_colour_tableau}},
\code{\link{scale_fill_economist}},
\code{\link{scale_fill_excel10}},
\code{\link{scale_fill_excel2003}},
\code{\link{scale_fill_solarized}},
- \code{\link{scale_fill_stata}},
\code{\link{scale_fill_tableau}}
}
View
@@ -32,19 +32,16 @@ dsamp <- diamonds[sample(nrow(diamonds), 1000), ]
\code{\link{scale_color_excel10}},
\code{\link{scale_color_excel2003}},
\code{\link{scale_color_few}},
- \code{\link{scale_color_stata}},
\code{\link{scale_color_tableau}},
\code{\link{scale_colour_economist}},
\code{\link{scale_colour_excel10}},
\code{\link{scale_colour_excel2003}},
\code{\link{scale_colour_few}},
- \code{\link{scale_colour_stata}},
\code{\link{scale_colour_tableau}},
\code{\link{scale_fill_economist}},
\code{\link{scale_fill_excel10}},
\code{\link{scale_fill_excel2003}},
\code{\link{scale_fill_few}},
- \code{\link{scale_fill_stata}},
\code{\link{scale_fill_tableau}}
}
View
@@ -30,24 +30,4 @@ dsamp <- diamonds[sample(nrow(diamonds), 1000), ]
+ theme_bw()
+ scale_color_stata("s1color"))
}
-\seealso{
- Other colour scales: \code{\link{scale_color_economist}},
- \code{\link{scale_color_excel10}},
- \code{\link{scale_color_excel2003}},
- \code{\link{scale_color_few}},
- \code{\link{scale_color_solarized}},
- \code{\link{scale_color_tableau}},
- \code{\link{scale_colour_economist}},
- \code{\link{scale_colour_excel10}},
- \code{\link{scale_colour_excel2003}},
- \code{\link{scale_colour_few}},
- \code{\link{scale_colour_solarized}},
- \code{\link{scale_colour_tableau}},
- \code{\link{scale_fill_economist}},
- \code{\link{scale_fill_excel10}},
- \code{\link{scale_fill_excel2003}},
- \code{\link{scale_fill_few}},
- \code{\link{scale_fill_solarized}},
- \code{\link{scale_fill_tableau}}
-}
View
@@ -38,6 +38,6 @@ q + theme_economist(dkpanel=TRUE) + scale_colour_economist(stata=TRUE)
\seealso{
Other themes: \code{\link{theme_excel2003}},
\code{\link{theme_few}}, \code{\link{theme_igray}},
- \code{\link{theme_solarized}}, \code{\link{theme_stata}}
+ \code{\link{theme_solarized}}
}
View
@@ -30,6 +30,6 @@ dsamp <- diamonds[sample(nrow(diamonds), 1000), ]
\seealso{
Other themes: \code{\link{theme_economist}},
\code{\link{theme_few}}, \code{\link{theme_igray}},
- \code{\link{theme_solarized}}, \code{\link{theme_stata}}
+ \code{\link{theme_solarized}}
}
View
@@ -19,6 +19,6 @@
Other themes: \code{\link{theme_economist}},
\code{\link{theme_excel2003}}, \code{\link{theme_igray}},
- \code{\link{theme_solarized}}, \code{\link{theme_stata}}
+ \code{\link{theme_solarized}}
}
View
@@ -26,6 +26,6 @@ dsamp <- diamonds[sample(nrow(diamonds), 1000), ]
\seealso{
Other themes: \code{\link{theme_economist}},
\code{\link{theme_excel2003}}, \code{\link{theme_few}},
- \code{\link{theme_solarized}}, \code{\link{theme_stata}}
+ \code{\link{theme_solarized}}
}
View
@@ -38,6 +38,6 @@ dsamp <- diamonds[sample(nrow(diamonds), 1000), ]
\seealso{
Other themes: \code{\link{theme_economist}},
\code{\link{theme_excel2003}}, \code{\link{theme_few}},
- \code{\link{theme_igray}}, \code{\link{theme_stata}}
+ \code{\link{theme_igray}}
}
View
@@ -2,12 +2,12 @@
\alias{theme_stata}
\title{ggplot theme based on Stata graph schemes}
\usage{
- theme_stata(base_size = 11, base_family = "",
- scheme = "s2color")
+ theme_stata(scheme = "s2color", base_size = 11,
+ base_family = "")
}
\arguments{
\item{scheme}{One of "s2color", "s2mono", "s1color",
- "s1rcolor", or "s1mono"}
+ "s1rcolor", or "s1mono", "s2manual", "s1manual", or "sj"}
\item{base_size}{base font size}
@@ -20,36 +20,37 @@
Stata graph schemes include what ggplot seperates into
themes and scales, as well as defaults specific to
different graph types (which ggplot does not support).
- The theme "s2color" corresponds to Stata schemes
- "s2color" and "s2gcolor"; "s2mono" corresponds to Stata
- schemes "s2mono", "s2gmanual", and "sj"; "s1rcolor" to
- "s1rcolor"; "s1color" to "s1color"; "s1mono" to "s1mono"
- and "s1manual".
+ These themes should be used in conjunction with
+ \code{\link{stata_colour_scale}}, see the examples.
}
\examples{
dsamp <- diamonds[sample(nrow(diamonds), 1000), ]
-(qplot(carat, price, data=dsamp, colour=clarity)
- + theme_stata()
- + scale_colour_stata("s2color"))
-(qplot(carat, price, data=dsamp, colour=clarity)
- + theme_stata("s1color")
- + scale_colour_stata("s1color"))
-(qplot(carat, price, data=dsamp, colour=clarity)
- + theme_stata("s1rcolor")
- + scale_colour_stata("s1rcolor"))
-(qplot(carat, price, data=dsamp, colour=clarity)
-+ theme_stata("s2mono")
-+ scale_colour_stata("mono"))
-(qplot(carat, price, data=dsamp, colour=clarity)
-+ theme_stata("s1mono")
-+ scale_colour_stata("mono"))
+q1 <- (qplot(carat, price, data=dsamp, colour=clarity)
+ + ggtitle("Diamonds"))
+q2 <- (qplot(carat, price, data=dsamp)
+ + facet_wrap(~ clarity)
+ + ggtitle("Diamonds"))
+q1mono <- (qplot(carat, price, shape=clarity, color=clarity,
+ data=dsamp)
+ + scale_shape_stata()
+ + ggtitle("Diamonds"))
+## s2color
+(q1 + theme_stata() + scale_colour_stata("s2color"))
+(q2 + theme_stata())
+## s2mono
+(q1mono + theme_stata("s2mono") + scale_colour_stata("mono"))
+(q2 + theme_stata("s2mono"))
+## s1color
+(q1 + theme_stata("s1color") + scale_colour_stata("s1color"))
+(q2 + theme_stata("s1color"))
+## s1rcolor
+(q1 + theme_stata("s1rcolor") + scale_colour_stata("s1rcolor"))
+(q2 + theme_stata("s1rcolor"))
+## s1mono
+(q1mono + theme_stata("s1mono") + scale_colour_stata("mono"))
+(q2 + theme_stata("s1mono"))
}
\references{
\url{http://www.stata.com/help.cgi?schemes}
}
-\seealso{
- Other themes: \code{\link{theme_economist}},
- \code{\link{theme_excel2003}}, \code{\link{theme_few}},
- \code{\link{theme_igray}}, \code{\link{theme_solarized}}
-}

0 comments on commit d7203ef

Please sign in to comment.