# Load necessary libraries
library(ggplot2)
# Create a sample data frame
data <- data.frame(
x = 1:10,
y = c(3, 1, 4, 1, 5, 9, 2, 6, 5, 3)
)
# Create a basic ggplot scatter plot
plot <- ggplot(data, aes(x = x, y = y)) +
# Add a line connecting the points with a solid line type
geom_line(aes(group = 1), linetype = "solid", color = "blue") +
# Add points on the plot
geom_point(size = 3, color = "red") +
# Customize x and y-axis labels
labs(x = "X-axis", y = "Y-axis") +
# Add a title to the plot
ggtitle("Scatter Plot with Line")
# Display the plot
print(plot)