ggproto

Display custom image as geom_point [duplicate]

ε祈祈猫儿з 提交于 2019-11-26 22:40:12
This question already has an answer here: How to use an image as a point in ggplot? 3 answers Is it possible to display custom image (say png format) as geom_point in R ggplot? library(png) pic1 <- readPNG("pic1.png") png("Heatmap.png", units="px", width=3200, height=3200, res=300) ggplot(data_frame, aes(medium, day, fill = Transactions)) + geom_tile(colour="white") + facet_grid(dime3_year~dime3_month) + scale_fill_gradient(high="blue",low="white") + theme_bw() + geom_point(aes(dime3_channel, day, size=Conv,alpha=Conv,image=(annotation_raster(pic1,xmin=0,ymin=0,xmax=5,ymax=5)),color="firebrick

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

筅森魡賤 提交于 2019-11-26 22:22:08
I'm using ggmap, and got the error below: Error: GeomRasterAnn was built with an incompatible version of ggproto. Please reinstall the package that provides this extension. I've installed the latest version of both ggmap(2.6.1) and ggplot2(2.2.0), but still got the same error. 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

qqnorm and qqline in ggplot2

做~自己de王妃 提交于 2019-11-26 18:47:10
问题 Say have a linear model LM that I want a qq plot of the residuals. Normally I would use the R base graphics: qqnorm(residuals(LM), ylab="Residuals") qqline(residuals(LM)) I can figure out how to get the qqnorm part of the plot, but I can't seem to manage the qqline: ggplot(LM, aes(sample=.resid)) + stat_qq() I suspect I'm missing something pretty basic, but it seems like there ought to be an easy way of doing this. EDIT: Many thanks for the solution below. I've modified the code (very

Changing whisker definition in geom_boxplot

早过忘川 提交于 2019-11-26 17:36:09
I'm trying to use ggplot2 / geom_boxplot to produce a boxplot where the whiskers are defined as the 5 and 95th percentile instead of 0.25 - 1.5 IQR / 0.75 + IQR and outliers from those new whiskers are plotted as usual. I can see that the geom_boxplot aesthetics include ymax / ymin, but it's not clear to me how I put values in here. It seems like: stat_quantile(quantiles = c(0.05, 0.25, 0.5, 0.75, 0.95)) should be able to help, but I don't know how to relate the results of this stat to set the appropriate geom_boxplot() aesthetics: geom_boxplot(aes(ymin, lower, middle, upper, ymax)) I've seen

Split violin plot with ggplot2

自古美人都是妖i 提交于 2019-11-26 14:24:21
I'd like to create a split violin density plot using ggplot, like the fourth example on this page of the seaborn documentation. Here is some data: set.seed(20160229) my_data = data.frame( y=c(rnorm(1000), rnorm(1000, 0.5), rnorm(1000, 1), rnorm(1000, 1.5)), x=c(rep('a', 2000), rep('b', 2000)), m=c(rep('i', 1000), rep('j', 2000), rep('i', 1000)) ) I can plot dodged violins like this: library('ggplot2') ggplot(my_data, aes(x, y, fill=m)) + geom_violin() But it's hard to visually compare the widths at different points in the side-by-side distributions. I haven't been able to find any examples of

Display custom image as geom_point [duplicate]

佐手、 提交于 2019-11-26 08:25:01
问题 This question already has answers here : How to use an image as a point in ggplot? (3 answers) Closed 2 years ago . Is it possible to display custom image (say png format) as geom_point in R ggplot? library(png) pic1 <- readPNG(\"pic1.png\") png(\"Heatmap.png\", units=\"px\", width=3200, height=3200, res=300) ggplot(data_frame, aes(medium, day, fill = Transactions)) + geom_tile(colour=\"white\") + facet_grid(dime3_year~dime3_month) + scale_fill_gradient(high=\"blue\",low=\"white\") + theme_bw

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

青春壹個敷衍的年華 提交于 2019-11-26 08:17:26
问题 I\'m using ggmap, and got the error below: Error: GeomRasterAnn was built with an incompatible version of ggproto. Please reinstall the package that provides this extension. I\'ve installed the latest version of both ggmap(2.6.1) and ggplot2(2.2.0), but still got the same error. 回答1: 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

Changing whisker definition in geom_boxplot

霸气de小男生 提交于 2019-11-26 05:29:21
问题 I\'m trying to use ggplot2 / geom_boxplot to produce a boxplot where the whiskers are defined as the 5 and 95th percentile instead of 0.25 - 1.5 IQR / 0.75 + IQR and outliers from those new whiskers are plotted as usual. I can see that the geom_boxplot aesthetics include ymax / ymin, but it\'s not clear to me how I put values in here. It seems like: stat_quantile(quantiles = c(0.05, 0.25, 0.5, 0.75, 0.95)) should be able to help, but I don\'t know how to relate the results of this stat to set

How to use an image as a point in ggplot?

一笑奈何 提交于 2019-11-26 04:20:42
Is there some way to use a specific small image as a point in a scatterplot with ggplot2. Ideally I will want to resize the images based on an variable. Here's an example: library(ggplot2) p <- ggplot(mtcars, aes(wt, mpg)) p + geom_point(aes(size = qsec, shape = factor(cyl))) So I basically want to know if there is a way to supply a specific image as the shape? 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)

How to use an image as a point in ggplot?

淺唱寂寞╮ 提交于 2019-11-26 01:53:17
问题 Is there some way to use a specific small image as a point in a scatterplot with ggplot2. Ideally I will want to resize the images based on an variable. Here\'s an example: library(ggplot2) p <- ggplot(mtcars, aes(wt, mpg)) p + geom_point(aes(size = qsec, shape = factor(cyl))) So I basically want to know if there is a way to supply a specific image as the shape? 回答1: Here's a minimalist geom to display raster images instead of points, library(ggplot2) library(grid) ## replace by a named list