tidyverse / tidyverse/ggplot2

Could ggplot support positioning the axis within the panel (e.g. in guide_axis)?

Open
#6,852 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Apologies if this has already been asked.

Sometimes it might be wanted to place an axis within a panel (e.g. at zero).

I was wondering if it was possible for dup_axis to provide this functionality?

So something like this for a y axis intercepting the x at 0..

p +
  scale_y_continuous(
    sec.axis = dup_axis(
      xintercept = 0,
    )
  )

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 reproducing the shown scale_y_continuous() and dup_axis() example and inspect ggplot2's axis and guide behavior. Determine how an axis could be positioned at x = 0 within the panel, whether dup_axis() or guide_axis() is the appropriate entry point, and define tests that verify the requested placement.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.