如何绘制按因子分组而不是箱形图的数据 [英] How to plot data grouped by a factor, but not as a boxplot

查看:70
本文介绍了如何绘制按因子分组而不是箱形图的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在R中,给定向量

casp6 <- c(0.9478638, 0.7477657, 0.9742675, 0.9008372, 0.4873001, 0.5097587, 0.6476510, 0.4552577, 0.5578296, 0.5728478, 0.1927945, 0.2624068, 0.2732615)

和一个因素:

trans.factor <- factor (rep (c("t0", "t12", "t24", "t72"), c(4,3,3,3)))

我想创建一个绘图,在该绘图中,数据点按因子定义进行分组.因此,类别应在x轴上,同一类别中的值应具有相同的x坐标.

I want to create a plot where the data points are grouped as defined by the factor. So the categories should be on the x-axis, values in the same category should have the same x coordinate.

简单地执行plot(trans.factor, casp6)几乎可以完成我想要的事情,它会产生一个箱形图,但是我想查看各个数据点.

Simply doing plot(trans.factor, casp6) does almost what I want, it produces a boxplot, but I want to see the individual data points.

推荐答案

require(ggplot2)
qplot(trans.factor, casp6)

这篇关于如何绘制按因子分组而不是箱形图的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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