Skip to content

default xlim and ylim in qplot are not supportd when non missing #4027

Closed
@moodymudskipper

Description

@moodymudskipper

See below. I think it's against the principles laid out in the tidyverse principle book, it can be fixed by using c(NA_real_, NA_real_) as a default.

The issue arose as I was writing a wrapper around qplot and it choked when passing the parameters xlim = xlim, ylim = ylim.

library(ggplot2)

# works
qplot(Sepal.Width, Sepal.Length, data = iris)

# doesn't work
qplot(Sepal.Width, Sepal.Length, data = iris, xlim = c(NA,NA))
#> Error in UseMethod("limits"): no applicable method for 'limits' applied to an object of class "logical"

# works
qplot(Sepal.Width, Sepal.Length, data = iris, xlim = c(NA_real_,NA_real_))

Created on 2020-05-25 by the reprex package (v0.3.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorscales 🐍

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions