3个变量的轴标签 [英] axes labels for 3 variables

查看:101
本文介绍了3个变量的轴标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是我想绘制一个看起来像这样的图

My question is I want to plot a graph looking something like this

在这里我想用x和y标签绘制点的简单图.这部分很好,但是然后像在照片中一样,我想在另一侧添加另一个标签,该标签与其他两个轴的相同数据点匹配 因此,如果我有一个简单的数据集,例如

Where I want to make a simple plot of points with x and y labels. This part is fine, but then like in the photo I would like to add another label on another side matching the same data points of the other two axis So if I have a simple data set like

x   y   name 
1   1   A
2   3   B
3   3   C

如何在与x,y点相对应的顶轴上添加名称A B和C?

How can I add the names A B and C on the top axis corresponding to the x,y points ?

谢谢.

推荐答案

如果我理解正确,请尝试

If I understand right try

df=data.frame(x=c(1,2,3),y=c(1,3,3),name=c('A','B','C'))

plot(df$x,df$y)
axis(side = 3,labels = df$name,at=df$x)

这篇关于3个变量的轴标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆