I have this code:
我有这段代码:
my dataset:
我的数据集:
founder wt.Df Replicate Block Food_Source Viability avg_val
1 A3 5905 1 1 Nicotine 0.4444444 0.4444444
2 A3 24834 1 1 Nicotine 0.6190476 0.6190476
3 A3 27861 1 1 Nicotine 0.4210526 0.5200501
4 A3 27861 2 1 Nicotine 0.6190476 0.5200501
5 A4 5905 1 1 Nicotine 0.7142857 0.7689076
6 A4 5905 2 1 Nicotine 0.8235294 0.7689076
7 A4 24834 1 1 Nicotine 0.4285714 0.5476190
8 A4 24834 1 1 Nicotine 0.6666667 0.5476190
9 A4 27861 1 1 Nicotine 0.6666667 0.6904762
10 A4 27861 1 1 Nicotine 0.7142857 0.6904762
qplot(x=founder, y=avg_val, group=wt.Df, data=Store, geom="line", colour = Store$wt.Df, main= "QCT on Nicotine", xlab = "Founder", ylab = "Average Viability") + geom_point()
What I want to do is define what each line is meaning using Store$wt.Df, I want to see what color line corresponds to it and label this to the right under legend wt.Df
我要做的是使用Store$wt定义每一行的含义。Df,我想看看它对应的颜色线在图例wt.Df的右边
1 个解决方案
#1
1
I'm not quite sure what you want. Could it be as easy as changing colour=Store$wt.Df
to colour=factor(Store$wt.Df)
?
我不太确定你想要什么。它能像改变颜色一样简单吗?Df =因素(存储wt.Df美元),颜色?
Store = read.table(text="founder wt.Df Replicate Block Food_Source Viability avg_val
1 A3 5905 1 1 Nicotine 0.4444444 0.4444444
2 A3 24834 1 1 Nicotine 0.6190476 0.6190476
3 A3 27861 1 1 Nicotine 0.4210526 0.5200501
4 A3 27861 2 1 Nicotine 0.6190476 0.5200501
5 A4 5905 1 1 Nicotine 0.7142857 0.7689076
6 A4 5905 2 1 Nicotine 0.8235294 0.7689076
7 A4 24834 1 1 Nicotine 0.4285714 0.5476190
8 A4 24834 1 1 Nicotine 0.6666667 0.5476190
9 A4 27861 1 1 Nicotine 0.6666667 0.6904762
10 A4 27861 1 1 Nicotine 0.7142857 0.6904762",header=TRUE)
qplot(x=founder, y=avg_val, group=wt.Df, data=Store, geom="line", colour = factor(Store$wt.Df),
main= "QCT on Nicotine", xlab = "Founder", ylab = "Average Viability") + geom_point()
#1
1
I'm not quite sure what you want. Could it be as easy as changing colour=Store$wt.Df
to colour=factor(Store$wt.Df)
?
我不太确定你想要什么。它能像改变颜色一样简单吗?Df =因素(存储wt.Df美元),颜色?
Store = read.table(text="founder wt.Df Replicate Block Food_Source Viability avg_val
1 A3 5905 1 1 Nicotine 0.4444444 0.4444444
2 A3 24834 1 1 Nicotine 0.6190476 0.6190476
3 A3 27861 1 1 Nicotine 0.4210526 0.5200501
4 A3 27861 2 1 Nicotine 0.6190476 0.5200501
5 A4 5905 1 1 Nicotine 0.7142857 0.7689076
6 A4 5905 2 1 Nicotine 0.8235294 0.7689076
7 A4 24834 1 1 Nicotine 0.4285714 0.5476190
8 A4 24834 1 1 Nicotine 0.6666667 0.5476190
9 A4 27861 1 1 Nicotine 0.6666667 0.6904762
10 A4 27861 1 1 Nicotine 0.7142857 0.6904762",header=TRUE)
qplot(x=founder, y=avg_val, group=wt.Df, data=Store, geom="line", colour = factor(Store$wt.Df),
main= "QCT on Nicotine", xlab = "Founder", ylab = "Average Viability") + geom_point()