Skip to content

axis_titles = "collect" does not work when modifying panel grid #458

Open

Description

@gevro

axis_titles = "collect" does not work when modifying panel grid

For example when adding theme(panel.grid.major.x = element_blank())

Activity

  1. trekonom commented on Nov 29, 2025

    @trekonom

    Could you provide a reproducible example? I tried to replicate your issue, but I wasn't able to do so. In the simple example below, for example, the axis titles are still collected even after the grid lines have been removed from one plot.

    library(ggplot2)
    library(patchwork)
    
    packageVersion("ggplot2")
    #> [1] '4.0.1'
    packageVersion("patchwork")
    #> [1] '1.3.2'
    
    p1 <- ggplot(mtcars) +
      geom_bar(aes(gear)) +
      theme(panel.grid.major.x = element_blank())
    
    p2 <- ggplot(mtcars) +
      geom_boxplot(aes(gear, disp, group = gear))
    
    p1 + p2 +
      plot_layout(axis_titles = "collect")

    Created on 2025-11-29 with reprex v2.1.1

  2. gevro commented on Nov 30, 2025

    @gevro
    Author

    Your example indeed works. I can't quite figure out why in my code it is not working. I will keep trying to make a reproducible example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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