0
bay <- structure(list(wbi = c(0.08, 0.08, 0.02, 0.26, 0.08, 0.08, 0.02, 
0.08, 0.08, 0.03, 0.26, 0.02, 0.08, 0.03, 0.08, 0.03, 0.08, 0.03, 
0.03, 0.02, 0.03, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.03, 0.08, 
0.08), medprice.n2 = c(39.99, 54.99, 44.99, 59.99, 49.99, 44.99, 
59.99, 54.99, 39.99, 49.99, 49.99, 59.99, 54.99, 44.99, 39.99, 
54.99, 39.99, 49.99, 44.99, 59.99, 39.99, 44.99, 49.99, 54.99, 
44.99, 54.99, 39.99, 39.99, 49.99, 59.99)), .Names = c("wbi", 
"medprice.n2"), row.names = c(2L, 21L, 23L, 46L, 60L, 62L, 63L, 
64L, 66L, 67L, 72L, 74L, 76L, 77L, 78L, 80L, 82L, 83L, 85L, 89L, 
91L, 92L, 95L, 96L, 97L, 102L, 103L, 104L, 106L, 108L), class = "data.frame")

以下のコードは、赤い線でグラフを生成します。赤線を に変更したいと思い#5182BAます。"red"下の 6 行目の単語を に置き換えましたhex #5182BAが、うまくいきませんでした (赤い線が表示されます)。この問題について高低を検索し、ggplot2 の本を参照しましたが、解決策を見つけることができませんでした。ありがとうございました

gg <- subset(bay, hp_quota == 1)
reg <- with(gg, lm(wbi ~ medprice.n2))
summary(reg)
ddply(gg, .(medprice.n2), summarise, mean=round(mean(wbi(q2final), na.rm=TRUE), 2))
ggplot(gg, aes( x = medprice.n2, 100*(y = wbi(q2final))))  + 
stat_smooth( method = lm, se = FALSE, size = 1.3, colour="red", fill="red")
coord_cartesian(ylim = c(0,25)) +  
scale_y_continuous(breaks= c(0, 5, 10, 15, 20, 25)) + 
theme(panel.grid.minor = element_blank()) +
theme(text=element_text(family="Arial", size=16)) +
theme(axis.ticks = element_blank()) + 
theme(axis.title.x = element_blank()) + 
#theme(axis.text.y = element_blank()) + 
theme(axis.title.y = element_blank()) + 
theme(axis.text.x = element_blank()) +
theme(legend.position = "none"))
4

1 に答える 1

0

ほとんどのコードは機能せず、再現性もありませんが、「赤」を「5182BA」に変更するとうまくいくようです。

ggplot(bay, aes(x=medprice.n2, y=wbi)) + 
    geom_smooth(method=lm, size=1.3, colour="#5182BA")
于 2013-07-03T11:42:30.673 に答える