Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error if axis breaks go out of range #261

Closed
wch opened this issue Nov 15, 2011 · 0 comments
Closed

Error if axis breaks go out of range #261

wch opened this issue Nov 15, 2011 · 0 comments

Comments

@wch
Copy link
Member

wch commented Nov 15, 2011

In the devel branch, ggplot gives an error if the breaks on an axis go out of the plotting range.

dat <- data.frame(x=1:3, y=1:3)

# All breaks within range: OK
ggplot(dat, aes(x=x,y=y)) + geom_point() +
    scale_y_continuous(breaks=1:3, labels=1:3)

# Breaks go out of range: not OK
ggplot(dat, aes(x=x,y=y)) + geom_point() +
    scale_y_continuous(breaks=1:4, labels=1:4)
# Error in scale_labels.continuous(scale) : 
#  Breaks and labels are different lengths

This can cause problems in cases where you want tell it to make tick marks, say, every 10, without being super careful about the actual range shown in the graph. This happens especially when there are manually-specified labels to go with the breaks.

I believe the release version didn't have this issue.

@hadley hadley closed this as completed in 6559901 Dec 2, 2011
@lock lock bot locked as resolved and limited conversation to collaborators Jun 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants