r - smooth out jagged geom_segment to look like geom_smooth -



r - smooth out jagged geom_segment to look like geom_smooth -

i'm trying set reference line in plot via geom_segment.

a simplified example:

trycatch({ spaghetti_smooth_ref = qplot(age,t_self, data=sest,geom="blank") + geom_smooth(method='lm',alpha=0.1, colour = "black") + geom_segment(aes(x = 16, xend = 45,y = coef(us_ref)["(intercept)"], yend = coef(us_ref)["(intercept)"] + coef(us_ref)["age"] * 45), linetype = "solid", colour = "#5e8fb0", alpha = 0.5, size = 0.1) + facet_wrap(~ country)+ scale_linetype_discrete() }, error = function(e){warning(e)})

as can see below, geom_smooth() rendered lot more smoothly geom_segment().

how can improve on this? it's same when viewed in rstudio on mac , when rendered pdf. i've plotted exact same slope 1 time using raw info , geom_smooth() , 1 time using geom_segment(), still differ.

can not define own reference line abline? e.g.

+ geom_abline(intercept = 48.5, slope = 0.1)

r ggplot2

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -