We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi,
using ggsubplot 0.3.2 with ggplot2 1.0.0 on R 3.1.2 does not work.
E.g. if I use your code to fix the missing map_americas and then run the geom_subplot example I just get
Error in layout_base(data, vars, drop = drop) : At least one layer must contain all variables used for facetting
It's the same error for my own attempts to create a map.
Thx Stefan
library(ggplot2) library(maps) library(plyr) # getbox by Heike Hoffman, # https://github.com/ggobi/paper-climate/blob/master/code/maps.r getbox <- function (map, xlim, ylim) { # identify all regions involved small <- subset(map, (long > xlim[1]) & (long < xlim[2]) & (lat > ylim[1]) & (lat < ylim[2])) regions <- unique(small$region) small <- subset(map, region %in% regions) # now shrink all nodes back to the bounding box small$long <- pmax(small$long, xlim[1]) small$long <- pmin(small$long, xlim[2]) small$lat <- pmax(small$lat, ylim[1]) small$lat <- pmin(small$lat, ylim[2]) # Remove slivvers small <- ddply(small, "group", function(df) { if (diff(range(df$long)) < 1e-6) return(NULL) if (diff(range(df$lat)) < 1e-6) return(NULL) df }) small } ## map layer ## adapted from map_nasa: # https://github.com/ggobi/paper-climate/blob/master/code/maps.r # assembling data world <- map_data("world") states <- map_data("state") states$group <- max(world$group) + states$group both <- rbind(world, states) americas <- getbox(both, xlim = c(-115, -55), ylim = c(-21.1, 36.6)) # building americas layer map_americas <- list( geom_polygon(aes(long, lat, group = group), data = americas, fill = "grey70", colour = "grey60", inherit.aes = FALSE, show_guide = FALSE), scale_x_continuous("", breaks = NULL, expand = c(0.02, 0)), scale_y_continuous("", breaks = NULL, expand = c(0.02, 0))) ggplot(nasa) + map_americas + geom_subplot(aes(long, lat, group = id, subplot = geom_point(aes(surftemp, temperature), size = 1/4))) + coord_map()
The text was updated successfully, but these errors were encountered:
Woops, sorry, duplicate of #10
But it's not limited to the examples but as far as I can tell to all plots.
Sorry, something went wrong.
No branches or pull requests
Hi,
using ggsubplot 0.3.2 with ggplot2 1.0.0 on R 3.1.2 does not work.
E.g. if I use your code to fix the missing map_americas and then run the geom_subplot example I just get
It's the same error for my own attempts to create a map.
Thx
Stefan
The text was updated successfully, but these errors were encountered: