As I said, the lines below that you provided worked well for me. Can you 
explain what this line does?:

# reshape to long format
    pivot_longer(-Dtime, names_to = "NO2") %>%

-------------------------------------------------

library(ggplot2)
library(dplyr)
library(tidyr)

b %>%
    mutate(Dtime = paste(Sys.Date(), Dtime),
                  Dtime = as.POSIXct(Dtime)) %>%
    select(Dtime, DNO2, MNO2) %>%
    # reshape to long format
    pivot_longer(-Dtime, names_to = "NO2") %>%
    # now plot
    ggplot(aes(Dtime, value, color = NO2)) +
    geom_line() +
    geom_point() +
    scale_color_manual(values = c("orange", "skyblue")) +
    # make datetime labels
    scale_x_datetime(date_breaks = "1 mins", date_labels = "%H:%M") +
    theme_bw()


        [[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