setwd("C:/Users/PAULA/Desktop/Datos doctorado/inercia/Archivos para paper")

require(ggplot2)
library(tidyr)
library(dplyr)
read.csv("Modhalfhour3dec.csv")
my.data<-read.csv("Modhalfhour3dec.csv")
my.data$Fecha <- as.POSIXct(my.data$Fecha, format="%d/%m/%Y %H:%M")
long.data <- my.data %>%
  pivot_longer(cols = c(M1, M5, M12),
               names_to = "Sensor",
               values_to = "Value")
long.data$Sensor <- factor(long.data$Sensor, 
                           levels = c("M1", "M5", "M12"))

ggplot(long.data, aes(x = Fecha, y = Value, color = Sensor, shape = Sensor)) +
  geom_line(linewidth = 1) +
  geom_point(size = 2) +
  scale_color_manual(
    values = c("M1" = "black", "M5" = "grey20", "M12" = "grey60"),
    name = "Sensor"   
  ) +
  scale_shape_manual(
    values = c("M1" = 16, "M5" = 17, "M12" = 15),
    name = "Sensor"   
  ) +
  labs(x = "Time",
       y = "Temperature (°C)") +
  theme_minimal() +
  theme(
    axis.text.x = element_text(angle = 45, hjust = 1),
    legend.position = "bottom"
  )