Skip to content

Commit 5ca2335

Browse files
committed
Draw only one set of logticks, and don't use aesthetics from data. Fixes #767
1 parent 576fd23 commit 5ca2335

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

R/annotation-logticks.r

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,31 @@
7171
#' a + annotation_logticks(short = unit(.5,"mm"), mid = unit(3,"mm"), long = unit(4,"mm"))
7272
#'
7373
annotation_logticks <- function (base = 10, sides = "bl", scaled = TRUE,
74-
short = unit(0.1, "cm"), mid = unit(0.2, "cm"), long = unit(0.3, "cm"), ...) {
75-
76-
GeomLogticks$new(base = base, sides = sides, raw = raw, scaled = scaled,
77-
short = short, mid = mid, long = long, ...)
74+
short = unit(0.1, "cm"), mid = unit(0.2, "cm"), long = unit(0.3, "cm"),
75+
colour = "black", size = 0.5, linetype = 1, alpha = 1, color = NULL, ...) {
76+
77+
if (!is.null(color))
78+
colour <- color
79+
80+
layer(
81+
geom = "logticks",
82+
geom_params = list(base = base, sides = sides, raw = raw, scaled = scaled,
83+
short = short, mid = mid, long = long, colour = colour,
84+
size = size, linetype = linetype, alpha = alpha, ...),
85+
stat = "identity",
86+
data = data.frame(x = NA),
87+
mapping = NULL,
88+
inherit.aes = FALSE,
89+
show_guide = FALSE
90+
)
7891
}
7992

8093
GeomLogticks <- proto(Geom, {
8194
objname <- "logticks"
8295

83-
draw <- function(., data, scales, coordinates, base = 10, sides = "bl", scaled = TRUE,
84-
short = unit(0.1, "cm"), mid = unit(0.2, "cm"), long = unit(0.3, "cm"), ...) {
96+
draw_groups <- function(., data, scales, coordinates, base = 10, sides = "bl",
97+
scaled = TRUE, short = unit(0.1, "cm"), mid = unit(0.2, "cm"),
98+
long = unit(0.3, "cm"), ...) {
8599

86100
ticks <- list()
87101

0 commit comments

Comments
 (0)