0

I have a chart drawn by geom_point using the code below. Is it normal that the confidence band does not cover the entire chart? I am using loess method:

ggplot(data,aes(x=Year_Month, y=CNT, group=1)) +
  geom_line(stat="identity", size=2, alpha=0.7, color="#00a9ff") +
  geom_point(size=5, color="#2787db") +
  geom_smooth(method = 'loess', color="red") +
  scale_y_continuous(breaks=seq(0,mx,5), limits = c(-2,mx)) +
  geom_text(label=data$CNT, vjust=-2, color="blue")

Chart: enter image description here

sample of my data: enter image description here

Ibo
  • 4,081
  • 6
  • 45
  • 65
  • It's possible you cut the ribbon off because of the limits on your y axis. Check by removing `limits` from `scale_y_continuous()`. – aosmith Jul 12 '18 at 20:24
  • Please share data in a [reproducible format](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). Pictures of data are not helpful. What if you take out the `scale_y_continuous` line? – MrFlick Jul 12 '18 at 20:24
  • yes, the problem is `scale_y_continuous`, but how can I manually control my y scale if this causes a problem for me? – Ibo Jul 12 '18 at 20:30
  • ok, the problem was -2 in the `scale_y_continuous`, I changed it to -5 and this way it covers the band entirely, thanks guys! – Ibo Jul 12 '18 at 20:38

0 Answers0