-
Notifications
You must be signed in to change notification settings - Fork 2.1k
theme: Add different ticks length for different axes #2934
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
Changes from 10 commits
8340ec7
4ee8b13
456e742
62d8ca3
296d4dd
65b4b13
107ee4a
efc0eb3
50aa9d9
26ed529
50f8cee
dc3b524
eb5b72a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,7 +47,8 @@ | |
#' `axis.ticks.y.left`, `axis.ticks.y.right`). `axis.ticks.*.*` inherits from | ||
#' `axis.ticks.*` which inherits from `axis.ticks`, which in turn inherits | ||
#' from `line` | ||
#' @param axis.ticks.length length of tick marks (`unit`) | ||
#' @param axis.ticks.length,axis.ticks.length.x,axis.ticks.length.x.top,axis.ticks.length.x.bottom,axis.ticks.length.y,axis.ticks.length.y.left,axis.ticks.length.y.right | ||
#' length of tick marks (`unit`) | ||
#' @param axis.line,axis.line.x,axis.line.x.top,axis.line.x.bottom,axis.line.y,axis.line.y.left,axis.line.y.right | ||
#' lines along axes ([element_line()]). Specify lines along all axes (`axis.line`), | ||
#' lines for each plane (using `axis.line.x` or `axis.line.y`), or individually | ||
|
@@ -192,12 +193,21 @@ | |
#' ) | ||
#' | ||
#' # Axes ---------------------------------------------------------------------- | ||
#' # Change styles of axes texts and lines | ||
#' p1 + theme(axis.line = element_line(size = 3, colour = "grey80")) | ||
#' p1 + theme(axis.text = element_text(colour = "blue")) | ||
#' p1 + theme(axis.ticks = element_line(size = 2)) | ||
#' p1 + theme(axis.ticks.length = unit(.25, "cm")) | ||
#' | ||
#' # Change the appearance of the y-axis title | ||
#' p1 + theme(axis.title.y = element_text(size = rel(1.5), angle = 90)) | ||
#' | ||
#' # Make ticks point outwards on y-axis and inwards on x-axis | ||
#' p1 + theme( | ||
#' axis.ticks.length.y = unit(.25, "cm"), | ||
#' axis.ticks.length.x = unit(-.25, "cm"), | ||
#' axis.text.x = element_text(margin = margin(t = .3, unit = "cm")) | ||
#' ) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use tidyverse indenting here (2 spaces only) and make sure there are two spaces around each |
||
#' | ||
#' \donttest{ | ||
#' # Legend -------------------------------------------------------------------- | ||
#' p2 <- ggplot(mtcars, aes(wt, mpg)) + | ||
|
@@ -275,6 +285,12 @@ theme <- function(line, | |
axis.ticks.y.left, | ||
axis.ticks.y.right, | ||
axis.ticks.length, | ||
axis.ticks.length.x, | ||
axis.ticks.length.x.top, | ||
axis.ticks.length.x.bottom, | ||
axis.ticks.length.y, | ||
axis.ticks.length.y.left, | ||
axis.ticks.length.y.right, | ||
axis.line, | ||
axis.line.x, | ||
axis.line.x.top, | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to nitpick, one last request, then I'll merge: Please move the period to after
(@pank, #2935)
, just like in the other news bullets.