如何在以下条形图中增加x和y轴的大小?
我需要将'freq'
和'heights'
增加到例如cex = 2
df = read.table(text = 'Heights freq
a 16
b 9
c 8
d 6
e 7
f 4
g 4
h 2
i 3
l 1', header = TRUE)
x = barplot(df$freq, cex.axis = 1.5, ylab = 'freq', xlab = 'heights')
axis(1, at = x, c('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
'h', 'i'), cex.axis = 1.5) #rename x-axis values
看起来很愚蠢,但我无法找到办法。
由于
答案 0 :(得分:1)
您只需在条形图代码中将cex.axis
更改为cex.lab
。
df = read.table(text = 'Heights freq
a 16
b 9
c 8
d 6
e 7
f 4
g 4
h 2
i 3
l 1', header = TRUE)
x = barplot(df$freq, cex.lab = 2, ylab = 'freq', xlab = 'heights')
axis(1, at = x, c('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
'h', 'i'), cex.axis = 1.5) #rename x-axis values