我想绘制一个图表:
X-axis: species (setosa,versicolor,virginica)
Y-axis: Sepal.Length
在包含虹膜数据集的三列的数据集上:Sepal.Length,Sepal.Width,Species
我希望Y轴是物种的名称,而是显示因子值 . 我试过这个命令:
plot(x = file$Sepal.Length, y = levels(file$Species), col = file$Species)
有没有方法可以使用plot()函数将唯一文本值作为Y轴查看?
1 回答
您可以将
yaxt='n'
传递给初始plot()
调用以防止自动绘制y轴,然后调用axis()
手动绘制所需的y轴 .