On Wed, 22 Dec 2021 16:58:18 +0000 (UTC) Kai Yang via R-help <r-help@r-project.org> wrote:
> mpg %>% filter(hwy <35) %>% ggplot(aes(x = displ, y = y[i], > color = c[i])) + geom_point() Your code relies on R's auto-printing, where each line of code executed at the top level (not in loops or functions) is run as if it was wrapped in print(...the rest of the line...). Solution: make that print() explicit. A better solution: explicitly pass the plot object returned by the ggplot functions to the ggsave() function instead of relying on the global state of the program. > ggsave("c:/temp/f[i].jpg",width = 9, height = 6, dpi = 1200, units = > "in") When you type "c:/temp/f[i].jpg", what do you get in return? Use paste0() or sprintf() to compose strings out of parts. > [[alternative HTML version deleted]] P.S. Please compose your messages in plain text, not HTML. See the R-help posting guide for more info. -- Best regards, Ivan ______________________________________________ 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.