使用 R 中的数据点名称绘制一维图
我有一个数据点列表(0.2、0.8、0.95),我想将它们绘制在一条线上。我想创建此范围值的一维刻度(垂直或水平),并将这些数据点的名称(苹果、香蕉、西红柿)与位于刻度上的数据点并列。我知道包中有一个相对简单的功能,但我再也找不到它了!请帮忙:)。
谢谢你, 安妮玛丽
I have a list of data points (0.2, 0.8, 0.95) that I want to plot on a line. I want to create a one-dimensional scale (vertical or horizontal) of this range of values with the names of those data points (apples, bananas, tomatoes) juxtaposed to the data points, which are positioned on the scale. I know there is a relatively easy function to this in a package but I can't find it anymore! Please help :).
Thank you,
Annemarie
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我想到的第一件事就是手动完成:
因为这样你就有了完全的控制权。还有一个名为
stripchart()
的函数,它可以进行一维绘图:The first thing t come to my mind was to do it by hand:
because then you have full control. There is also a function called
stripchart()
, that does 1-d plotting:neither is very beautiful, but you can take it from there.
不确定是否有一个函数可以做到这一点,我能想到的最接近的是 if
dotchart
但它不一样。但是,这样怎么样:结果是:
Not sure about a function to do this, closest I can think of if
dotchart
but its not the same. However, how about this:Which results in:
我在 vegan 库中找到了一个方便的函数来执行此操作:
希望它对某些人有用。
I found a handy function in the vegan library to do this:
Hopefully it is of use to somebody some time.