문제

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")

This code below generates the graph with a red line. I would like to change the red line to #5182BA. I replaced the words "red"in the sixth line below with the hex #5182BA but that did not work (red line appears). I have searched high and low on this issue, consulted my ggplot2 books, but was not able to find a solution. Thank you

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"))
도움이 되었습니까?

해결책

Altough most of your code does not work and is not reproducible, changing "red" to "5182BA" seems to work fine.

ggplot(bay, aes(x=medprice.n2, y=wbi)) + 
    geom_smooth(method=lm, size=1.3, colour="#5182BA")
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top