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.

Reply via email to