Permalink
Browse files

economist_theme: added note and example for using ITC Officina Sans font

  • Loading branch information...
jrnold committed Oct 4, 2012
1 parent 358dcbb commit f142d41df2ec6e4c36997265ec6b2a57be8793ed
Showing with 43 additions and 1 deletion.
  1. +2 −1 DESCRIPTION
  2. +20 −0 R/economist.R
  3. +21 −0 man/theme_economist.Rd
View
@@ -16,7 +16,8 @@ Imports:
scales (>= 0.2.2)
Suggests:
plyr,
- reshape2
+ reshape2,
+ extrafont
Description: Some extra themes and scales for ggplot.
License: GPL-2
URL: http://github.com/jrnold/ggplot-jrnold
View
@@ -125,6 +125,10 @@ scale_fill_economist <- function(stata=FALSE, ...) {
##'
##' Style plots similar to those in The Economist.
##'
+##' The Economist uses "ITC Officina Sans" as its font for graphs. If
+##' you have access to this font, you can use it with the
+##' \bold{extrafont} package. "Verdana" is a good substitute.
+##'
##' @param base_size base font size
##' @param base_family base font family
##' @param horizontal \code{logical}. Horizontal axis lines?
@@ -133,6 +137,13 @@ scale_fill_economist <- function(stata=FALSE, ...) {
##' economist scheme.
##' @export
##' @family themes
+##'
+##' @references
+##' \itemize{
+##' \item \href{http://spiekermann.com/en/itc-officina-display/}{Spiekerblog, "ITC Officina Display", January 1, 2007.}
+##' \item \url{http://www.economist.com/help/about-us}
+##' }
+##'
##' @examples
##' dsamp <- diamonds[sample(nrow(diamonds), 1000), ]
##' q <- qplot(carat, price, data=dsamp, colour=clarity)
@@ -146,6 +157,15 @@ scale_fill_economist <- function(stata=FALSE, ...) {
##' (q + theme_economist(horizontal=FALSE)
##' + scale_colour_economist() + coord_flip()
##' + ggtitle("Diamonds Are Forever"))
+##' \dontrun{
+##' ## The Economist uses ITC Officina Sans
+##' library(extrafont)
+##' (q + theme_economist(base_family="ITC Officina Sans")
+##' + scale_colour_economist())
+##' ## Verdana is a widely available substitute
+##' (q + theme_economist(base_family="Verdana")
+##' + scale_colour_economist())
+##' }
theme_economist <- function(base_size = 10, base_family="",
horizontal=TRUE, dkpanel=FALSE, stata=FALSE) {
if (stata) {
View
@@ -21,6 +21,12 @@
\description{
Style plots similar to those in The Economist.
}
+\details{
+ The Economist uses "ITC Officina Sans" as its font for
+ graphs. If you have access to this font, you can use it
+ with the \bold{extrafont} package. "Verdana" is a good
+ substitute.
+}
\examples{
dsamp <- diamonds[sample(nrow(diamonds), 1000), ]
q <- qplot(carat, price, data=dsamp, colour=clarity)
@@ -34,6 +40,21 @@ q + theme_economist(dkpanel=TRUE) + scale_colour_economist(stata=TRUE)
(q + theme_economist(horizontal=FALSE)
+ scale_colour_economist() + coord_flip()
+ ggtitle("Diamonds Are Forever"))
+\dontrun{
+## The Economist uses ITC Officina Sans
+library(extrafont)
+(q + theme_economist(base_family="ITC Officina Sans")
++ scale_colour_economist())
+## Verdana is a widely available substitute
+(q + theme_economist(base_family="Verdana")
++ scale_colour_economist())
+}
+}
+\references{
+ \itemize{ \item
+ \href{http://spiekermann.com/en/itc-officina-display/}{Spiekerblog,
+ "ITC Officina Display", January 1, 2007.} \item
+ \url{http://www.economist.com/help/about-us} }
}
\seealso{
Other themes: \code{\link{theme_excel2003}},

0 comments on commit f142d41

Please sign in to comment.