I have an SQL server from where I import data which includes a date column, then convert it to a tibble, summarize, group the data according to a particular variable and plot it with date as x-axis. without grouping the data is plotted on full screen. grouping the data by color correctly assigns individual color to each group but re-sizes the plot to less than half the screen. what am I doing wrong?
The data I import from SQL server is similar to the test data test_Data
generated using code below
test_Data <- data.frame(region = rep(c("WER", "EAR", "NOR", "KCR"), each=10),
values = sample(100:200, 40, replace = TRUE),
date_time = seq.Date(from = as.Date("2024-04-01"),
as.Date("2024-05-10"), by = "day"))
#color by region
test_Data %>%
ggplot() +
geom_line(mapping = aes(date_time, values, colour = region))
So when I run the code, I get a well grouped data but is plotted half the screen. But without grouping by colour, I get a full screen plot but with lines not connecting. See the Image attached enter image description here