Skip to content

Commit

Permalink
update themes to fix issues with new ggplot2
Browse files Browse the repository at this point in the history
- add margin argument to element_text
- remove axis.ticks.margin elements
  • Loading branch information
jrnold committed Aug 5, 2015
1 parent b4fc14c commit ee4b1ec
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
1 change: 0 additions & 1 deletion DESCRIPTION
Expand Up @@ -18,7 +18,6 @@ Depends:
ggplot2 (>= 1.0.0.9003)
Imports:
colorspace,
grid,
scales,
methods
Suggests:
Expand Down
7 changes: 3 additions & 4 deletions R/economist.R
Expand Up @@ -197,23 +197,22 @@ theme_economist <- function(base_size = 10, base_family="sans",
colour = NA, size = 0.5, linetype = 1),
text = element_text(family = base_family, face = "plain",
colour = "black", size = base_size, hjust = 0.5, vjust = 0.5,
angle = 0, lineheight = 1),
angle = 0, lineheight = 1, margin = margin()),
## Axis
axis.text = element_text(size = rel(1)),
axis.line = element_line(size = rel(0.8)),
axis.line.y = element_blank(),
axis.text = element_text(size = rel(1)),
axis.text.x = element_text(vjust = 1),
axis.text.y = element_text(hjust = 0),
## I cannot figure out how to get ggplot to do 2 levels of ticks
## axis.ticks.margin = unit(3/72, "in"),
axis.ticks = element_line(),
axis.ticks.y = element_blank(),
axis.title = element_text(size = rel(1)),
axis.title.x = element_text(),
axis.title.y = element_text(angle = 90),
# axis.ticks.length = unit(-1/32, "in"),
axis.ticks.length = unit(-base_size * 0.5 , "points"),
# axis.ticks.margin = unit(3/72, "in"),
axis.ticks.margin = unit(base_size * 1.25, "points"),
legend.background = element_rect(linetype=0),
legend.margin = unit(base_size * 1.5, "points"),
legend.key = element_rect(linetype=0),
Expand Down
3 changes: 1 addition & 2 deletions R/stata.R
Expand Up @@ -72,7 +72,7 @@ theme_stata_base <- function(base_size = 11, base_family = "sans") {
rect = element_rect(size = 0.5, linetype = 1, fill="white", colour="black"),
text = element_text(family = base_family, face = "plain", colour="black",
size = base_size, hjust = 0.5, vjust = 1, angle = 0,
lineheight = 1),
lineheight = 1, margin = margin()),
title = element_text(),
## Axis
axis.line = element_line(),
Expand All @@ -87,7 +87,6 @@ theme_stata_base <- function(base_size = 11, base_family = "sans") {
# axis.ticks.length = stata_gsize$tiny,
# axis.ticks.margin = stata_gsize$half_tiny,
axis.ticks.length = unit(4/11, "lines"),
axis.ticks.margin = unit(2/11, "lines"),
legend.background = element_rect(linetype=1),
legend.margin = unit(1.2 / 100, "npc"),
legend.key = element_rect(linetype=0),
Expand Down
6 changes: 3 additions & 3 deletions R/theme-foundation.R
Expand Up @@ -9,21 +9,21 @@ theme_foundation_null <- function(base_size=12, base_family="") {
size = 0.5, linetype = 1),
text = element_text(family = base_family, face = "plain",
colour = "black", size = base_size,
hjust = 0.5, vjust = 0.5, angle = 0, lineheight = 0.9),
hjust = 0.5, vjust = 0.5, angle = 0, lineheight = 0.9,
margin = margin()),
axis.text = element_text(),
strip.text = element_text(),
axis.line = element_blank(),
axis.title= element_text(),
axis.title.x = element_text(),
axis.title.y = element_text(),
axis.text = element_text(),
axis.text = element_text(margin = unit(0.1, "cm")),
axis.text.x = element_text(),
axis.text.y = element_text(),
axis.ticks = element_line(),
axis.ticks.x = element_line(),
axis.ticks.y = element_line(),
axis.ticks.length = unit(0.15, "cm"),
axis.ticks.margin = unit(0.1, "cm"),
axis.line = element_line(),
axis.line.x = element_line(),
axis.line.y = element_line(),
Expand Down
3 changes: 2 additions & 1 deletion vignettes/children/examples.Rmd
Expand Up @@ -13,7 +13,8 @@ Quantitative Information*.

```{r tufte-rangeframe}
(ggplot(mtcars, aes(wt, mpg))
+ geom_point() + geom_rangeframe()
+ geom_point()
+ geom_rangeframe()
+ theme_tufte())
```

Expand Down

0 comments on commit ee4b1ec

Please sign in to comment.