tidyverse / tidyverse/ggplot2

Unexpected behaviour when combine scales = "free" and axes = "all"

Open
#6,900 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
7k
Forks
2.1k
Avg merge
59m
Merged PRs (30d)
2

Description

I love the new feature of being able to add axes and their labels to interior facets (See #4064). But it didn't combine as I expected when using scales = "free" as well.

This is an example with mpg:

library(ggplot2)
#> Warning: package 'ggplot2' was built under R version 4.4.3
ggplot(mpg, aes(cty, manufacturer)) +
  geom_point() +
  facet_grid(year ~ drv, axes = "all", axis.labels = "all", scales = "free")

Created on 2026-09-14 with reprex v2.1.1

In my use case the separate panels are different versions of a model and the names on the y axis are terms in the model and the terms in the model vary in the different versions so it is confusing to have all of them labelled. It would be perfect if the labels could stay in the same location, so that one can read across a row to compare between facets, but with the labels blank for the manufacturer levels that are not present in that facet.

This only really makes sense with discrete variables but it would be super helpful!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided mpg example with facet_grid(), scales = "free", axes = "all", and axis.labels = "all" to reproduce the panel labels. Trace how facet_grid() combines free discrete scales with interior axis labels. Done means labels remain aligned across each row while staying blank for manufacturer levels absent from a facet.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.