更改 hexbinplot 中轴注释的字体大小
Changing the fontsize of axis annotations in a hexbinplot
我想增加 hexbinplot 中轴注释的字体大小。
library(hexbin)
df <- data.frame(x=rnorm(1000),y=rnorm(1000))
hb <- hexbin(x=df$x, df$y)
myPlot <- plot(hb, xlab="", ylab="", legend=FALSE)
我希望轴上的 -3, ..., 2 和 -2, ..., 3 更大。
already helped me with axis labels, but ("use grid.ls()
" - 怎么样?)对我来说有点太神秘了。我对基本图形比点阵更流利。
试试这个。
library(grid)
myPlot <- plot(hb, xlab="", ylab="", legend=FALSE)
grid.ls()
# GRID.rect.250
# GRID.xaxis.251
# GRID.yaxis.252
# GRID.polygon.253
grid.edit("GRID.xaxis.251", gp=gpar(fontsize=20))
grid.edit("GRID.yaxis.252", gp=gpar(fontsize=20))
grid.ls()
函数显示了图形的各个部分。轴标签为 GRID.xaxis.251
和 GRID.yaxis.252
。名称标签应该相同,但数字会不同,因此您必须修改 grid.edit()
行以匹配 grid.ls()
.
的输出
我想增加 hexbinplot 中轴注释的字体大小。
library(hexbin)
df <- data.frame(x=rnorm(1000),y=rnorm(1000))
hb <- hexbin(x=df$x, df$y)
myPlot <- plot(hb, xlab="", ylab="", legend=FALSE)
我希望轴上的 -3, ..., 2 和 -2, ..., 3 更大。
grid.ls()
" - 怎么样?)对我来说有点太神秘了。我对基本图形比点阵更流利。
试试这个。
library(grid)
myPlot <- plot(hb, xlab="", ylab="", legend=FALSE)
grid.ls()
# GRID.rect.250
# GRID.xaxis.251
# GRID.yaxis.252
# GRID.polygon.253
grid.edit("GRID.xaxis.251", gp=gpar(fontsize=20))
grid.edit("GRID.yaxis.252", gp=gpar(fontsize=20))
grid.ls()
函数显示了图形的各个部分。轴标签为 GRID.xaxis.251
和 GRID.yaxis.252
。名称标签应该相同,但数字会不同,因此您必须修改 grid.edit()
行以匹配 grid.ls()
.