题
在R,如何让我平行于X轴,而不是平行于Y轴?
A(巴)标绘Y轴标签其他提示
使用par(las=1)
。
请参阅?par
:
las
numeric in {0,1,2,3}; the style of axis labels.
0: always parallel to the axis [default],
1: always horizontal,
2: always perpendicular to the axis,
3: always vertical.
作为<强>马切伊Jończyk强>提到的,可能还需要增加利润
par(las=2)
par(mar=c(8,8,1,1)) # adjust as needed
plot(...)
您需要60度如下旋转x轴标签使用主题()函数:
ggplot(...)+...+ theme(axis.text.x = element_text(angle=60, hjust=1))
首先,对于图表创建数据
H <- c(1.964138757, 1.729143013, 1.713273714, 1.706771799, 1.67977205)
M <- c("SP105", "SP30", "SP244", "SP31", "SP147")
其次,给出的名称为图表文件
png(file = "Bargraph.jpeg", width = 500, height = 300)
第三,画出条形图
barplot(H,names.arg=M,ylab="Degree ", col= rainbow(5), las=2, border = 0, cex.lab=1, cex.axis=1, font=1,col.axis="black")
title(xlab="Service Providers", line=4, cex.lab=1)
最后,保存文件
dev.off()
输出:
不隶属于 StackOverflow