y轴上的绘图百分比

编程入门 行业动态 更新时间:2024-10-10 07:26:56
本文介绍了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轴上的绘图百分比

本文发布于:2023-07-19 13:38:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1157052.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:百分比

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!