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

Errors while using geom_subplot2d #3

Closed
KMGehweiler opened this issue Sep 19, 2012 · 3 comments
Closed

Errors while using geom_subplot2d #3

KMGehweiler opened this issue Sep 19, 2012 · 3 comments

Comments

@KMGehweiler
Copy link

There are several errors while using subplot2d:

ggplot(casualties, aes(lon, lat), size = 0) +geom_subplot2d(aes(lon, lat, subplot = geom_bar(aes(victim, ..count.., fill = victim))), ref = NULL, width = rel(0.8))
Using binwidth 1.36
Error in UseMethod("fullseq") :
no applicable method for 'fullseq' applied to an object of class "c('double', 'numeric')"

ggplot(casualties, aes(lon, lat), size = 0) +geom_subplot2d(aes(lon, lat, subplot = geom_bar(aes(victim, ..count.., fill = victim))), binwidth=0.1, ref = NULL, width = rel(0.8))
Error in UseMethod("fullseq") :
no applicable method for 'fullseq' applied to an object of class "c('double', 'numeric')"

ggplot(casualties, aes(lon, lat), size = 0) +geom_subplot2d(aes(lon, lat, subplot = geom_bar(aes(victim, ..count.., fill = victim))), bins=c(15,12), ref = NULL, width = rel(0.8))
Using binwidth 0.905
Error in UseMethod("fullseq") :
no applicable method for 'fullseq' applied to an object of class "c('double', 'numeric')"

ggplot(casualties, aes(lon, lat), size = 0) +geom_subplot2d(aes(lon, lat, subplot = geom_bar(aes(victim, ..count.., fill = victim))), breaks=c(-0.5,0,0.5), ref = NULL, width = rel(0.8))
Error: Zero breaks in scale for x/xmin/xmax/xend/xintercept
In addition: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf
3: In min(x) : no non-missing arguments to min; returning Inf
4: In max(x) : no non-missing arguments to max; returning -Inf

@KMGehweiler
Copy link
Author

I really like the idea of this package, but it makes me sad that the example for embedded bar charts isn't working. :-(

@garrettgman
Copy link
Owner

KMG,

Thanks for pointing this out. The first three examples work on my machine. I suspect it has to do with package versioning. Do they go away for you when you run R 2.15.1 and ggplot2 v 0.9.2?

The last example fails because of the way you use breaks. geom_subplot2d needs breaks to be a list that contains a vector for the x variable and a vector for the y variable. In this case, the ranges of lat and lon are fairly far from c(-1, 1). Try something like this. It should work.

ggplot(casualties, aes(lon, lat), size = 0) +
  geom_subplot2d(aes(lon, lat, 
    subplot = geom_bar(aes(victim, ..count.., fill = victim))), 
    breaks=list(c(60,65,70, 75), c(28, 33, 38)), ref = NULL, width = rel(0.8))

Garrett

@KMGehweiler
Copy link
Author

Thank you very much, everything works now! :-)
(I was working with R 2.15.0 before.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants