[英]Making a barplot with known frequencies
Sorry for puting this silly question: I am reading the book "Using R for Introductory Statistics" and would like to create a barplot using this data抱歉提出这个愚蠢的问题:我正在阅读“使用 R 进行介绍性统计”一书,并想使用此数据创建条形图
install.packages("UsingR")
library(UsingR)
head(scrabble)
piece points frequency
1 A 1 9
4 B 3 2
7 C 3 2
10 D 2 4
The variable piece shows the letter, and the variable frequency its respective frequency in the scrabble game.可变块显示字母,可变频率表示拼字游戏中的相应频率。 Specifically, I would like to have on the X axis the letters, and on the Y axis the frequencies.具体来说,我想在 X 轴上有字母,在 Y 轴上有频率。
Thank you in advance先感谢您
Take a look at barplot()
, eg :看看barplot()
,例如:
barplot(scrabble$frequency,
names = scrabble$piece,
xlab = "Piece",
ylab = "Frequency",
main = "Letter Frequencies")
To show all x-axis labels:要显示所有 x 轴标签:
barplot(scrabble$frequency,
names = scrabble$piece,
xlab = "Piece",
ylab = "Frequency",
main = "Letter Frequencies",
las = 2,
cex.names = 0.5)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.