Hi, what about this one?
ggplot(data=mpg[mpg$year==1999,], aes(x=displ, y=hwy))+ geom_point() Best, Robin On 10/21/20 3:37 PM, Engin Yılmaz wrote: > Dear > > I use dataset , as called "mpg" > > This is code > > ggplot(data=mpg)+ geom_point(mapping = aes(x=displ, y=hwy, colour=year)) > > But I would like to see only "year of 1999" in this relationship between x > and y variables > > How could I change the code in this direction? > > I found the following code > > library(dplyr)year_1999 <- filter(mpg, year=="1999")ggplot(year_1999, > aes(x=displ, y=hwy)) + geom_point() > > > I found other code > > ggplot(data = mpg, mapping = aes(x = displ, y = hwy)) + > > geom_point( > > data = filter(mpg, year == "1999") > > ) > > > Is there more compact code ? > > > sincerely > Engin YILMAZ > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. > -- Dr. Robin Haunschild Max Planck Institute for Solid State Research Heisenbergstr. 1 D-70569 Stuttgart (Germany) phone: +49 (0) 711-689-1285 fax: +49 (0) 711-689-1292 email: r.haunsch...@fkf.mpg.de http://www.fkf.mpg.de/ivs Publons: https://publons.com/researcher/2845202/robin-haunschild/ GS: https://scholar.google.de/citations?user=kDfateQAAAAJ&hl=de&oi=ao
______________________________________________ R-help@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.