-
Notifications
You must be signed in to change notification settings - Fork 17
Closed
Description
The axis is not aligned if plot is with coord_fixed() or theme(aspect.ratio = 1).
example:
library(ggplot2)
library(aplot)
df = data.frame(x=rnorm(100), y=rnorm(100))
p.scatter = ggplot(df, aes(x=x, y=y)) + geom_point()
p.xmargin = ggplot(df, aes(x=x)) + geom_histogram()
p.ymargin = ggplot(df, aes(y=y)) + geom_histogram()
apx = p.scatter %>% insert_top(p.xmargin)
print(apx) # works fine
# fix aspect ratio for scatter plot
apx[2,1] <- apx[2,1] + coord_fixed()
print(apx) # x-axis is not aligned if canvas height:width < 2
# insert_right is also affected
apy = (p.scatter + coord_fixed()) %>% insert_right(p.ymargin)
print(apy) # the y-axis is not aligned if canvas width:height < 2Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels