R:由足够的唯一值导致的stat_smooth错误

时间:2015-05-14 08:56:06

标签: r colors ggplot2 smooth

我有一个Dataset,想要使用stat_smooth()显示一个数字。

首先,我可以显示Age vs Scored_Probabilities(男性)数字,如下所示:

names(dataset2) <- sub(pattern=' ', replacement='.', x=names(dataset2))

dataSet3 <- subset(dataset2,Gender== 'male')
#patterns VS Age
d <- ggplot(dataSet3, aes(y=Scored.Probabilities, x=jitter(as.numeric(Age)), colour=factor(patterns)))
d + stat_smooth() +scale_colour_brewer(palette="Set3")

Man

但是当男性变为女性时,会出现错误:

#Female
dataset4 <- subset(dataset2,Gender== 'female')

#patterns VS Age
d <- ggplot(dataset4, aes(y=Scored.Probabilities, x=jitter(as.numeric(Age)), colour=factor(patterns)))
d + stat_smooth()+scale_colour_brewer(palette="Set3") 
Error in smooth.construct.cr.smooth.spec(object, data, knots) : 
  x has insufficient unique values to support 10 knots: reduce k.

第二,&#34; Set3&#34;颜色似乎不足以绘制。哪种颜色可以解决它?

0 个答案:

没有答案