Skip to content

New themes that do not overwrite existing ones #923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 17, 2014
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,9 @@ export(theme_classic)
export(theme_get)
export(theme_gray)
export(theme_grey)
export(theme_light)
export(theme_line)
export(theme_linedraw)
export(theme_minimal)
export(theme_rect)
export(theme_segment)
Expand Down
46 changes: 45 additions & 1 deletion R/theme-defaults.r
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ theme_grey <- function(base_size = 12, base_family = "") {
theme_gray <- theme_grey


#' A theme with white background and black gridlines.
#' A theme with white background and dark gridlines.
#'
#' @param base_size base font size
#' @param base_family base font family
Expand All @@ -82,6 +82,50 @@ theme_bw <- function(base_size = 12, base_family = "") {
)
}

#' A theme with white background and black gridlines.
#'
#' @param base_size base font size
#' @param base_family base font family
#' @export
theme_linedraw <- function(base_size = 12, base_family = "") {
# Starts with theme_grey and then modify some parts
theme_grey(base_size = base_size, base_family = base_family) %+replace%
theme(
axis.text = element_text(colour = "black", size = rel(0.8)),
axis.ticks = element_line(colour = "black", size=0.25),
legend.key = element_rect(colour = "black", size=0.25),
panel.background = element_rect(fill = "white", colour = NA),
panel.border = element_rect(fill = NA, colour = "black", size=0.5),
panel.grid.major = element_line(colour = "black", size = 0.05),
panel.grid.minor = element_line(colour = "black", size = 0.01),
strip.background = element_rect(fill = "black", colour = NA),
strip.text.x = element_text(colour = "white"),
strip.text.y = element_text(colour = "white", angle = -90)
)
}

#' A theme with white background and light grey lines
#'
#' @param base_size base font size
#' @param base_family base font family
#' @export
theme_light <- function(base_size = 12, base_family = "") {
# Starts with theme_grey and then modify some parts
theme_grey(base_size = base_size, base_family = base_family) %+replace%
theme(
axis.ticks = element_line(colour = "grey50", size=0.25),
legend.key = element_rect(fill="white", colour = "grey50", size=0.25),
panel.background = element_rect(fill = "white", colour = NA),
panel.border = element_rect(fill = NA, colour = "grey50", size=0.5),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spaces around = please

panel.grid.major = element_line(colour = "grey80", size=0.25),
panel.grid.minor = element_line(colour = "grey92", size = 0.125),
strip.background = element_rect(fill = "grey50", colour = NA),
strip.text.x = element_text(colour = "white"),
strip.text.y = element_text(colour = "white", angle = -90)
)

}

#' A minimalistic theme with no background annotations.
#'
#' @param base_size base font size
Expand Down
4 changes: 2 additions & 2 deletions man/theme_bw.Rd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
% Generated by roxygen2 (4.0.0): do not edit by hand
\name{theme_bw}
\alias{theme_bw}
\title{A theme with white background and black gridlines.}
\title{A theme with white background and dark gridlines.}
\usage{
theme_bw(base_size = 12, base_family = "")
}
Expand All @@ -11,6 +11,6 @@ theme_bw(base_size = 12, base_family = "")
\item{base_family}{base font family}
}
\description{
A theme with white background and black gridlines.
A theme with white background and dark gridlines.
}

16 changes: 16 additions & 0 deletions man/theme_light.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
% Generated by roxygen2 (4.0.0): do not edit by hand
\name{theme_light}
\alias{theme_light}
\title{A theme with white background and light grey lines}
\usage{
theme_light(base_size = 12, base_family = "")
}
\arguments{
\item{base_size}{base font size}

\item{base_family}{base font family}
}
\description{
A theme with white background and light grey lines
}

16 changes: 16 additions & 0 deletions man/theme_linedraw.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
% Generated by roxygen2 (4.0.0): do not edit by hand
\name{theme_linedraw}
\alias{theme_linedraw}
\title{A theme with white background and black gridlines.}
\usage{
theme_linedraw(base_size = 12, base_family = "")
}
\arguments{
\item{base_size}{base font size}

\item{base_family}{base font family}
}
\description{
A theme with white background and black gridlines.
}