render this (mybooks)

filteredbooks <- cleanbooks |>
  filter(readyear != "2021") |>
  group_by(readdate) |>
  summarise(bookspermonth = n(),
    sumpages = sum(pages),
            meanpages = mean(pages),
            meanapproval = mean(goodreads),
            meanpopularity = mean(numgoodreads),
            authorcount = n_distinct(author),
    meanage = round(mean(authorage), 0))
# accident plot i didnt mean to do this
ggplot(cleanbooks) +
  geom_point(aes(x = title, y = title, color = "amazon")) +
  geom_point(aes(x = title, y = goodreads, color = "goodreads")) +
  labs(x = "rating",
       color = "platform") +
  # scale_color_manual(values = c(
  #   "goodreads" = "#33a302",
  #   "amazon" = "#f3a3a3"
  # )) +
  theme(axis.text.y=element_blank(),
  axis.ticks.y=element_blank(),
  axis.title.y=element_blank())

ggplot(filteredbooks, aes(x = readdate, y = bookspermonth, color = sumpages)) +
  geom_line() +
  scale_x_date(date_breaks = "2 month", date_labels = "%m/%y") +
  scale_color_gradient(high = "#FCD4CA", low = "#8EB0F5", aesthetics = "color")

readbooksnumber <- cleanbooks |>
  group_by(readdate) |>
  summarise(bookspermonth = n())


obscurebooks <- cleanbooks |>
  filter(readyear != "2021") |>
  group_by(readmy, readdate) |>
  summarise(meanpopularity = mean(numgoodreads))

obscurebooksX <- obscurebooks |> left_join(readbooksnumber, by = "readdate")

ggplot(obscurebooksX, aes(x = readdate, y = meanpopularity, color = bookspermonth)) +
  geom_line(size = 0.75) +
  scale_color_gradient(low = "#A4C6B8", high = "#651461", aesthetics = "color") +
  scale_x_date(breaks = "2 month", date_labels = "%m/%y") +
  theme_light() +
  labs(title = "Popularity of books I've read",
       x = "Date", 
       y = "Mean number of Goodreads reviews",
       color = "Books read") +
  theme(axis.line = element_line(linewidth = 0.6, colour = "#7F0078", arrow = arrow(angle = 30, length = unit(0.1, "inches"), ends = "last", type = "open")),
    plot.background = element_rect(fill = "#DFDEEE", colour = "#400C3E", linewidth = 1.6),
    plot.margin = margin(0.8, 0.8, 0.8, 0.8, "cm"),
    legend.background = element_rect(fill = "#C1D2DE", linewidth = 0.3),
    legend.ticks = element_line(color = "transparent", size = unit(1, "inches")),
    legend.ticks.length = unit(3, "inches"),
    legend.position = c(.13, .73),
   # legend.key.size = unit(.5, 'cm')
  )

goodreadbooks <- cleanbooks |>
  filter(readyear != "2021") |>
  group_by(readmy, readdate) |>
  summarise(meanapproval = mean(goodreads))

goodreadbooksX <- goodreadbooks |> left_join(readbooksnumber, by = "readdate")

ggplot(goodreadbooksX, aes(x = readdate, y = meanapproval, color = bookspermonth)) +
  geom_line() +
  scale_color_gradient(low = "#FCA0F1", high = "#780016", aesthetics = "color") +
  scale_x_date(breaks = "2 month", date_labels = "%m/%y") +
  theme_light() +
  labs(title = "Goodreads approval of my monthly books",
       x = "Date", 
       y = "Average Goodreads review ratings",
       color = "Books read") +
  theme(axis.line = element_line(linewidth = 0.6, colour = "#790016", arrow = arrow(angle = 30, length = unit(0.1, "inches"), ends = "last", type = "open")),
    plot.background = element_rect(fill = "#FFDCF3", colour = "#6C0014", linewidth = 1.6),
    plot.margin = margin(0.8, 0.8, 0.8, 0.8, "cm"),
    legend.background = element_rect(fill = "#FFD4F0", linewidth = 0.3),
    legend.ticks = element_line(color = "transparent", size = unit(1, "inches")),
    legend.ticks.length = unit(3, "inches"),
    legend.position = c(.8, .3)
  )

ggplot(filteredbooks) +
  geom_line(aes(x = readdate, y = bookspermonth, alpha = 0.5, color = "Books read per month")) +
  geom_line(aes(x = readdate, y = authorcount, alpha = 0.5, color = "Authors per month"))
Warning: Removed 1 row containing missing values or values outside the scale range
(`geom_line()`).
Removed 1 row containing missing values or values outside the scale range
(`geom_line()`).