我有一些问题需要指出确定平滑曲线的特定点,特别是那些有关于" stadio" as.factor
处于5个级别(值从1到6),此列中的所有其他点都是NA。
srt(tab1a)
'data.frame': 870 obs. of 11 variables:
$ mese : Factor w/ 11 levels "agiu","blug",..: 1 1 1 1 1 1 1 1 1 1 ...
$ sito : Factor w/ 2 levels "sin","tav": 2 2 2 2 2 2 2 2 2 2 ...
$ area : Factor w/ 2 levels "a","b": 1 1 1 1 1 1 1 1 1 1 ...`
$ staz : Factor w/ 2 levels "1","2": 1 1 1 1 1 1 1 1 1 1 ...
$ classe : Factor w/ 3 levels "g","m","p": 1 1 1 1 1 1 1 1 2 2 ...
$ taglia : num 59 62 62 65 68 54 51 58 45 45 ...
$ p_umido : num 83.2 97.8 100.2 102.1 130.3 ...
$ p_umido_go: Factor w/ 563 levels "0.008","0.01",..: 525 558 458 506 485 402 378 521 358 240 ...
$ igs : num 8.34 9.49 5.39 6.13 4.49 6.22 6.6 8.16 8.92 5.63 ...
$ sesso : Factor w/ 2 levels "f","m": NA 2 2 2 NA NA NA NA NA NA ...
$ stadio : Factor w/ 5 levels "1","3","4","5",..: NA 4 4 5 NA NA NA NA NA NA ...
plot.tav1 <- qplot(taglia, igs, data=tab1a[1:84, ],col=mese, geom=c("smooth"), span=0.5)
plot.tav1 + layer(geom="point", size=4) +
scale_colour_gradient("stadio", low="blue", high="white", na.value = "grey50")
这是我代表曲线的代码,当我添加&#34; scale_colour_gradient
&#34;的最后一部分时会出现错误。
答案 0 :(得分:0)
类似的东西:
set.seed(1492)
# make some similar data
tab1a <- data.frame(
mese=sample(LETTERS[1:11], 84, replace=TRUE),
taglia=runif(84, 50, 70),
igs=runif(84, 5, 10))
tab1a_colors <- colorRampPalette(c("white", "blue"))(11)
gg <- ggplot(data=tab1a, aes(x=taglia, y=igs, color=mese))
gg <- gg + geom_smooth(span=0.5)
gg <- gg + geom_point(size=4)
gg <- gg + scale_color_manual(name="stadio", values=tabla_colors)
gg <- gg + theme_bw()
gg