[R-sig-Geo] Solid and dashed line.

Ashim Kapoor @@h|mk@poor @end|ng |rom gm@||@com
Sun Feb 14 09:34:53 CET 2021


Dear Enoch,

Would this suffice for you ?

library(ggplot2)

ggplot(mtcars, aes(x=wt, y=mpg)) +
  geom_point( color="black")+
  geom_smooth(method=lm, se=FALSE,
              color="darkred")

ggplot(mtcars, aes(x=wt, y=mpg)) +
  geom_point( color="black")+
  geom_smooth(method=lm, se=FALSE, linetype="dashed",
              color="darkred")

Note : I got these examples from :
http://www.sthda.com/english/wiki/ggplot2-scatter-plots-quick-start-guide-r-software-and-data-visualization

Best Regards,
Ashim




On Sun, Feb 14, 2021 at 1:50 PM Enoch Gyamfi Ampadu <egampadu using gmail.com>
wrote:

> Dear list,
>
> Please I need some assistance. I have been asked to produce a 1:1 line
> (dashed) and a line of best fit (solid) in a scatter plot. I have tried
> geom_abline() but it gives only the solid line. I also tried lty("dashed")
> to get the dashed line but it not working. I would be glad if I could get
> some assistance on how to do it.
>
> Best regards,
>
> Enoch.
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list