本文介绍了y轴上的绘图百分比的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用此图绘制
plot(dates,returns)我希望将returns表示为百分比而不是数字. 0.1将成为10%.同样,y轴上的数字向左倾斜90度.是否可以使它们水平出现?
I would like to have the returns expressed as percentages instead of numbers. 0.1 would become 10%. Also, the numbers on the y-axis appear tilted 90 degrees on the left. Is it possible to make them appear horizontally?
推荐答案这是使用las=TRUE来在y轴上旋转标签,并使用axis()来调整标签的新y轴的一种方法.
Here is one way using las=TRUE to turn the labels on the y-axis and axis() for the new y-axis with adjusted labels.
dates <- 1:10 returns <- runif(10) plot(dates, returns, yaxt="n") axis(2, at=pretty(returns), lab=pretty(returns) * 100, las=TRUE)更多推荐
y轴上的绘图百分比
发布评论