ggmap Error: GeomRasterAnn was built with an incompatible version of ggproto

I ran into this problem as well today, and I had to install the GitHub development versions of ggplot2 and ggmap and restart R to get rid of this error: devtools::install_github(“dkahle/ggmap”) devtools::install_github(“hadley/ggplot2”) Before that, I also reinstalled all of the packages mentioned here: https://github.com/thomasp85/ggraph/issues/10 Don’t know if those reinstalls were necessary, as it was ultimately … Read more

Display custom image as geom_point [duplicate]

The point geom is used to create scatterplots, and doesn’t quite seem to be designed to do what you need, ie, display custom images. However, a similar question was answered here, which indicates that the problem can be solved in the following steps: (1) Read the custom images you want to display, (2) Render raster … Read more

Changing whisker definition in geom_boxplot

geom_boxplot with stat_summary can do it: # define the summary function f <- function(x) { r <- quantile(x, probs = c(0.05, 0.25, 0.5, 0.75, 0.95)) names(r) <- c(“ymin”, “lower”, “middle”, “upper”, “ymax”) r } # sample data d <- data.frame(x=gl(2,50), y=rnorm(100)) # do it ggplot(d, aes(x, y)) + stat_summary(fun.data = f, geom=”boxplot”) # example with … Read more

How to use an image as a point in ggplot?

Here’s a minimalist geom to display raster images instead of points, library(ggplot2) library(grid) ## replace by a named list with matrices to be displayed ## by rasterGrob .flaglist <- list(“ar” = matrix(c(“blue”, “white”, “blue”), 1), “fr” = matrix(c(“blue”, “white”, “red”), 1)) flagGrob <- function(x, y, country, size=1, alpha=1){ grob(x=x, y=y, country=country, size=size, cl = “flag”) … Read more

Split violin plot with ggplot2

Or, to avoid fiddling with the densities, you could extend ggplot2‘s GeomViolin like this: GeomSplitViolin <- ggproto(“GeomSplitViolin”, GeomViolin, draw_group = function(self, data, …, draw_quantiles = NULL) { data <- transform(data, xminv = x – violinwidth * (x – xmin), xmaxv = x + violinwidth * (xmax – x)) grp <- data[1, “group”] newdata <- plyr::arrange(transform(data, … Read more