Skip to content

geom_point() and geom_jitter(width = 0, height = 0) have different behaviors for zero values in scale_y_log10() #4790

Closed
@iamstein

Description

@iamstein

I'm using ggplot2 3.3.5 and found that geom_point() and geom_jitter(height = 0, width = 0) have different behaviors for dealing with zero values in log-transformed axes. In particular, geom_point() represents zeros as dots lying on the x-axis whereas geom_jitter() does not plot the zeros at all. For me, this is relevant, because sometimes I want the jitter width to be non-zero, but height to be zero, and I don't want my dots to disappear! Right now I work around the issue by setting the zeros to some small value I choose to make the plot nice.

data = data.frame(x = c(0, 0, 1, 1, 2, 2), y = c(0, 0, 0, 1, 2, 3))
ggplot(data, aes(x = x, y = y)) + geom_point() + scale_y_log10()
ggplot(data, aes(x = x, y = y)) + geom_jitter(height = 0, width = 0) + scale_y_log10()

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorpositions 🥇

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions