在hexbinplot中更改轴注释的字体大小 [英] Changing the fontsize of axis annotations in a hexbinplot

查看:154
本文介绍了在hexbinplot中更改轴注释的字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在hexbinplot中增加轴注释的字体大小.

I would like to increase the font size of axis annotations in a 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更大.

I would like the -3, ..., 2 and the -2, ..., 3 on the axes to be larger.

此早期的线程已经帮助我处理了轴 labels ,但是grid.ls()"-怎么做?)对我来说有点太神秘了.我在基本图形方面比在格子方面更为流利.

This earlier thread already helped me with axis labels, but the suggestion about how to change the annotations ("use grid.ls()" - how?) is a little too cryptic for me. I am more fluent in base graphics than in lattice.

推荐答案

尝试一下.

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.251GRID.yaxis.252.名称标签应该相同,但数字将不同,因此您必须修改grid.edit()行以匹配grid.ls()的输出.

The grid.ls() function shows the parts of the graph. The axis labels are GRID.xaxis.251 and GRID.yaxis.252. The name labels should be the same but the numbers will be different so you will have to modify the grid.edit() lines to match the output from grid.ls().

这篇关于在hexbinplot中更改轴注释的字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆