首页 文章
  • 3 votes
     answers
     views

    编写ggplot自定义几何函数

    我正在编写一个函数来创建ggplot的散点图,其中点的大小表示具有相同X和Y坐标的点的数量 . 我有一个有效的功能: require(dplyr) plot_size_bubbles <- function(x,y) { dd = data.frame(x,y) %>% group_by(x,y) %>% summarise(n=n()) %>% ...
  • 6 votes
     answers
     views

    ggplot2 2.0 new stat_ function:设定给定美学的默认比例

    我尝试在R中使用ggplot2的新功能,允许创建我们自己的 stat_ 函数 . 我正在创建一个简单的计算和绘制排列在2d数组上的点之间的插值表面 . 我想创建一个需要 x , y 和 val 美学的stat_topo(),绘制一个简单的 geom_raster 插值 val 映射到 fill . library(ggplot2) library(dplyr) library(akima) c...
  • 33 votes
     answers
     views

    如何在ggplot中使用图像作为一个点?

    有没有办法在ggplot2的散点图中使用特定的小图像作为点 . 理想情况下,我会想要根据变量调整图像大小 . 这是一个例子: library(ggplot2) p <- ggplot(mtcars, aes(wt, mpg)) p + geom_point(aes(size = qsec, shape = factor(cyl))) 所以我基本上想知道是否有办法提供特定图像作为形状?
  • 3 votes
     answers
     views

    你能手动控制ggplot2 geom_point躲避/重叠顺序吗? [重复]

    这个问题在这里已有答案: control hierachy of position_dodge 1回答 最近对ggplot2(2.2.0)的更新打破了我们的一些情节,因为绘制点的顺序已经改变 . 例如,以下代码: library(dplyr) library(ggplot2) library(tibble) df <- tribble(~a, ~x, ~y, ...
  • 2 votes
     answers
     views

    使用facet将表添加到ggplot

    可重现的代码: x = sample(1:12,100,replace=TRUE) y = rnorm(100) z = sample(c('Sample A','Sample B'),100,replace=TRUE) d = data.frame(x,y,z) ggplot(data=d, aes(factor(x),y)) + geom_boxplot() + stat_summary(fu...
  • 20 votes
     answers
     views

    将自定义图像显示为geom_point [重复]

    这个问题在这里已有答案: How to use an image as a point in ggplot? 3个答案 是否可以在R ggplot中将自定义图像(例如png格式)显示为geom_point? library(png) pic1 <- readPNG("pic1.png") png("Heatmap.png", units=&quo...

热门问题