Skip to content

scale_[xy]_discrete() causes removal of breaks/labels #1589

Closed
@gfiumara

Description

@gfiumara

Summary

Using scale_[xy]_discrete(), regardless of arguments, causes axis labels and breaks to disappear without warning.

Example

library(ggplot2)
xyDF <- data.frame(x = 1:10, y = 1:10)
ggplot(data = xyDF, mapping = aes(x = x, y = y)) +
    geom_line() +
    geom_point() +
    scale_x_discrete()

Expected results

Plot showing breaks and labels at 1:10 on the X axis.

ggplot2_101
Created with ggplot2 1.0.1, as I cannot reproduce with 2.1.0.

Actual results

Plot with no breaks or labels on the X axis (as if scale_x_discrete(labels = NULL, breaks = NULL) was added to the plot instead of the default waiver()).
ggplot2_2

Notes

  • Regression since ggplot2 1.0.1 (last major version I've been using) fb3931c.
  • Present in devtools and CRAN version as of 22 March 2016.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions