Skip to content

axis alignment #419

Open
Open
@r2evans

Description

@r2evans

It's possible this related to (or a dupe of) #166 ...

Example code:

dats <- split(mtcars, ~ cyl)
ggs <- lapply(dats, function(dat) free(ggplot(dat, aes(mpg, disp)) + geom_point() + geom_vline(xintercept = 18)))
des <- do.call(c, Map(function(x, i) area(l=min(c(18, x$mpg)), r=max(c(18, x$mpg)), t=i, b=i), dats, seq_along(dats)))
des
# 3 patch areas, spanning 33 columns and 3 rows
#     t  l b  r
# 1:  1 18 1 33
# 2:  2 17 2 21
# 3:  3 10 3 19
Reduce(`/`, ggs) + plot_layout(design = des)

Image

Is it possible to align the plots so that the vlines (all at 18) are aligned? In this example, I'd like to not extend all scales to the max range of values. (I've tried free(type=) variants, no significant improvement.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions