我正在尝试使用rpy2在ggplot2中自定义一个图例。我注意到ggplot2到rpy2没有scale_shape_discrete和其他在中显示为自定义图例所必需的方法。
from rpy2.robjects.lib import ggplot2
# not present
ggplot2.scale_shape_discrete
在ggplot2中通过rpy2重命名/自定义离散图例的正确方式是什么?这些方法是否可访问?
我正在使用ggplot2打印空间点数据(sf)。颜色映射到关联的值。颜色的图例意外地使用了多边形形状,因为它将用于可能具有单独的颜色和填充属性的二维几何图形。有没有一种方法可以指定颜色图例的形状,这样我就可以使它成为一个实心圆? library(sf)
library(ggplot2)
set.seed(2)
df <- data.frame(x = runif(10, min = 0, max = 10),
y = runif(10, min = 0, max = 10),
value = sample(c(FAL
当使用黑色背景的ggplot2主题时,是否可以控制颜色参考线以外的参考线的图例颜色,以便不以黑色绘制?如果是这样的话,是怎么做的?
library(ggplot2) # needs to be 0.9.3 for this theme
data(iris) # included with ggplot2
theme_black<- function (base_size = 16, base_family = ""){
theme_minimal() %+replace%
theme(
line = el