减小线条厚度和“Corr:' ggpairs plot中的字体大小

时间:2016-09-26 18:20:23

标签: r ggplot2 ggally

我正在做一个ggpairs情节,但回归线太厚了,并且' Corr:'文字字体太大了。

public static void main(String[] args) {
    Scanner invoer = new Scanner(System.in);
    System.out.print("Wat is het \"plof\" getal? (2..9)");
    int plof = invoer.nextInt();
    System.out.print("Tot en met welk getal moet ik tellen?");
    int telGetal = invoer.nextInt();

    for(int i=0; i<= telGetal; i++) {
        System.out.print(" "+i);
    }
    System.out.println(" ");
}

这是输出:

enter image description here

我无法在GGally文档中找到我可以设置的内容。

任何指针?

3 个答案:

答案 0 :(得分:2)

这个怎么样?

lowerFn <- function(data, mapping, ...) {
  p <- ggplot(data = data, mapping = mapping) +
    geom_point(color = 'blue', alpha=0.3, size=4) +
    geom_smooth(color = 'black', method='lm', size=1,...)
  p
}

g <- ggpairs( 
  data = mtcars,
  lower = list(
    continuous =  wrap(lowerFn)
  )
)
g <- g + theme(
  axis.text = element_text(size = 6),
  axis.title = element_text(size = 6),
  legend.background = element_rect(fill = "white"),
  panel.grid.major = element_line(colour = NA),
  panel.grid.minor = element_blank(),
  panel.background = element_rect(fill = "grey95")
)
print(g, bottomHeightProportion = 0.5, leftWidthProportion = .5)

enter image description here

答案 1 :(得分:2)

尝试此操作以增加字体大小:

@IBAction func buttonClicked(sender:UIButton) {
    let cell = tableView.cellForRowAtIndexPath(NSIndexPath.init(forRow: sender.tag, inSection: 0))
    cell.myLabel.text = arrayList[sender.tag]
}

enter image description here

答案 2 :(得分:0)

@Chris Snow:使用upper函数的ggpairs参数wrap ggally_cor函数。 size = 2会解决您的问题,但我也添加了color = "black",以防您想要更改颜色。 礼貌:Change colors in ggpairs now that params is deprecated

修改后的MWE是:

data(mtcars)
head(mtcars)

mtcars$am <- as.factor(mtcars$am)

g <- ggpairs( 
  data = mtcars,
  lower = list(
    continuous = wrap("smooth", alpha = 0.3, color = "blue") 
    ),
  upper = list(continuous = wrap(ggally_cor, size = 2, color = "black")))
g <- g + theme(
    axis.text = element_text(size = 6),
    axis.title = element_text(size = 6),
    legend.background = element_rect(fill = "white"),
    panel.grid.major = element_line(colour = NA),
    panel.grid.minor = element_blank(),
    panel.background = element_rect(fill = "grey95")
  )
print(g, bottomHeightProportion = 0.5, leftWidthProportion = .5)