I'd try this when I get back to work. However, I can post the R code that is used to plot the graph. The parameters AE & Average. P is decimal while BrewDate is DateTime. It's a line chart with as many as 15 data points:
# The following code to create a dataframe and remove duplicated rows is always executed and acts as a preamble for your script:
# dataset <- data.frame(BrewDate, AE, Average P.)
# dataset <- unique(dataset)
# Paste or type your script code here:
# Load required libraries
# Load required libraries
# Load required libraries
# Load required libraries
# Load required libraries
# Load required libraries
# Load required libraries
library(ggplot2)
library(scales)
# Convert 'BrewDate' values to datetime objects
dataset$BrewDate <- as.POSIXct(dataset$BrewDate)
# Sort the data by 'BrewDate' to ensure x-axis alignment
dataset <- dataset[order(dataset$BrewDate), ]
# Plot the data
p <- ggplot(dataset, aes(x = BrewDate)) +
geom_line(aes(y = AE), color = "blue", linetype = "solid") +
geom_line(aes(y = `Average P.`), color = "red", linetype = "solid") +
geom_point(aes(y = AE), color = "blue", shape = 4) + # Use shape 4 for blue marker
geom_point(aes(y = `Average P.`), color = "red", shape = 4) + # Use shape 4 for red marker
scale_y_continuous(name = "AE. P", sec.axis = sec_axis(~., name = "Temp. Celsius"),
breaks = scales::pretty_breaks(n = 20)) + # Adjust the number of breaks on y-axis
scale_x_datetime(breaks = "1 day", date_labels = "%b %d") + # Adjust the breaks on x-axis
labs(x = "Brew Date") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1),
panel.grid.major = element_line(color = "gray", linetype = "dotted"), # Add major gridlines
panel.grid.minor = element_line(color = "gray", linetype = "dotted")) # Add minor gridlines
# Print the plot
print(p)