[R] Plot a line using ggplot2

Jeff Newmiller jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Fri Dec 9 02:18:12 CET 2022


Please run your code before you send it. Your example is not reproducible.

library(ggplot2)

linedata<- data.frame(
  PointEstx = c( 1, 2 )
, PointEsty = c( 1, 1.5 )
)
# make sure we have a data frame
str(linedata)

#plot the data
ggplot(
  linedata
, aes( x = PointEstx
     , y = PointEsty
     )
) + geom_line()

On December 8, 2022 5:05:47 PM PST, "Sorkin, John" <jsorkin using som.umaryland.edu> wrote:
>Colleagues,
>
>I am trying to plot a simple line using ggplot2. I get the axes, but I don't get the line. Please let me know what my error I am making.
>Thank you,
>John
>
># Define x and y values
>PointEstx <- Estx+1.96*SE
>PointEsty  <- 1
>
>row2 <- cbind(PointEstx,PointEsty)
>linedata<- data_frame(rbind(row1,row2))
>linedata
># make sure we have a data frame
>class(linedata)
>
>#plot the data
>ggplot(linedata,aes(x=PointEstx, y=PointEsty), geom_line())
>
>
>
>
>
>______________________________________________
>R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

-- 
Sent from my phone. Please excuse my brevity.



More information about the R-help mailing list