tidyverse / tidyverse/ggplot2

When x values contain 0, using coord_trans("sqrt") removes the axis line

Open
#5,919 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

ggplot(iris,aes(Petal.Length,Sepal.Width))+
  geom_point()+
  coord_trans(x="sqrt")+
  theme(axis.line.x = element_line(color="black"))

image

iris$Petal.Length[1]=0
ggplot(iris,aes(Petal.Length,Sepal.Width))+
  geom_point()+
  coord_trans(x="sqrt")+
  theme(axis.line.x = element_line(color="black"))

image

I believe the axis line should stay preserved, since sqrt(0)=0, or is there a conceptual error in my reasoning?

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 two ggplot examples from the issue and compare the x-axis rendering when Petal.Length contains no zero versus a zero. Trace the coord_trans("sqrt") handling and axis-line rendering; done means the x-axis line remains visible when sqrt(0)=0.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.