y轴上的绘图百分比 [英] Plot percentages on y-axis
本文介绍了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轴上的绘图百分比的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文