2014-03-31 24 views
0

我已经做了使用嘎嘎聚类并在结束我有数据的格式如下: enter image description here如何在同一图中绘制每个群集的箱形图?

我需要绘制箱线图的相同的图中的每个集群。 (即有5个簇),所以在X轴上,我需要1到5个簇号,而在Y轴上我需要年龄。)

我做了以下事情。但我无法达到我的预期。 enter image description here enter image description here enter image description here

任何人都可以提出正确的设置,以获得5箱线图中每个群集并行?

+1

我不知道拉特尔,但在控制台中,您可以使用一个公式如下:'foo < - data.frame(Age = rnorm(100),Cluster = sample(LETTERS [1:5],100,replace = TRUE))',那么boxplot:'boxplot(Age〜Cluster ,foo)' –

+0

谢谢@Stephan Kolassa – Nadaraj

+0

我找到了原因。群集变量的格式应该是“Category” – Nadaraj

回答

0

在你可以做到。首先在框架中读取文件。 评论< - read.csv( “abc.csv”,stringsAsFactors = FALSE)

箱线图(评论$岁〜评论$ Cluster)的

相关问题