Created
February 10, 2023 14:57
-
-
Save schochastics/bdb8d564a18e683eda00eaedbe6b35cf to your computer and use it in GitHub Desktop.
recreate chart style of daily mail
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggplot2) | |
library(ggpubr) | |
library(ggtext) | |
df <- data.frame(x=seq.Date(as.Date("2020-04-01"),as.Date("2022-07-01"),by="month"),y=(1:28)^2) | |
p <- ggplot(df, aes(x, y))+ | |
geom_line(linewidth = 2.2,color="white",lineend = "round")+ | |
geom_line(linewidth = 1,color="red",lineend = "round")+ | |
scale_x_date(labels=scales::label_date("%b\n%Y"))+ | |
theme(axis.text = element_text(size=12,color="white",face = "bold"), | |
axis.ticks = element_blank(), | |
panel.grid.major.x = element_blank(), | |
panel.grid.minor.x = element_blank(), | |
panel.grid.minor.y = element_blank(), | |
panel.grid.major.y = element_line(color="black"), | |
plot.title.position = "plot", | |
plot.title = element_textbox_simple( | |
size = 16, halign = 0.5, | |
lineheight = 1, | |
padding = margin(5.5, 5.5, 5.5, 5.5), | |
margin = margin(-5.5, -5.5, 5.5, -5.5), | |
fill = "red",face = "bold" | |
))+ | |
labs(x="",y="", | |
title = " <span style = 'color:white;'>AN INTERESTING COVID 19 CHART WITH BOGUS DATA</span>") | |
pfinal <- ggimage::ggbackground(p, "https://europeanlung.org/wp-content/uploads/2021/04/coronavirus-1024x590.jpg") | |
ggsave("covid.png",pfinal) |
Author
schochastics
commented
Feb 10, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment