使用 barplot() 增加轴标签大小

Increase axes labels size with barplot()

如何在以下条形图中增加 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

这可能看起来很傻,但我找不到办法。

谢谢

您只需要在条形图代码中将 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