tweak: save R tweaks.
This commit is contained in:
parent
178f0a55ab
commit
f08db69b57
BIN
blog/2022/11/20/brief-update-ea-funding/.source/.RData
Normal file
BIN
blog/2022/11/20/brief-update-ea-funding/.source/.RData
Normal file
Binary file not shown.
512
blog/2022/11/20/brief-update-ea-funding/.source/.Rhistory
Normal file
512
blog/2022/11/20/brief-update-ea-funding/.source/.Rhistory
Normal file
|
@ -0,0 +1,512 @@
|
|||
open_philanthropy_plot <- ggplot(data=df2, aes(x=year, y=amount, fill=area, group = cummulative_amount_for_its_area))+
|
||||
geom_bar(stat="identity")+
|
||||
labs(
|
||||
title=title_text,
|
||||
subtitle=subtitle_text,
|
||||
x=element_blank(),
|
||||
y=element_blank()
|
||||
) +
|
||||
# scale_fill_wsj() +
|
||||
# scale_fill_tableau(dir =1) +
|
||||
# scale_fill_tableau(palette, dir=direction) +
|
||||
# scale_fill_viridis(discrete = TRUE) +
|
||||
# scale_fill_brewer(palette = "Set2") +
|
||||
scale_fill_d3( "category20", alpha=0.8) +
|
||||
# scale_fill_uchicago("dark") +
|
||||
# scale_fill_startrek() +
|
||||
scale_y_continuous(labels = scales::dollar_format(scale = 0.000001, suffix = "M"), breaks = c(0:6)*10^8)+
|
||||
scale_x_continuous(breaks = years)+
|
||||
theme_tufte() +
|
||||
theme(
|
||||
legend.title = element_blank(),
|
||||
plot.title = element_text(hjust = 0.5),
|
||||
plot.subtitle = element_text(hjust = 0.5),
|
||||
legend.position="bottom",
|
||||
legend.box="vertical",
|
||||
axis.text.x=element_text(angle=60, hjust=1),
|
||||
legend.text=element_text(size=7, hjust = 0.5)
|
||||
) +
|
||||
geom_text(aes(label=ifelse(amount > 25e6, paste0(round(amount / 1e6, 0), "M"), "")), size = 2, position = position_stack(vjust = 0.5)) +
|
||||
geom_text(
|
||||
aes(label = paste0(round(after_stat(y) / 1e6, 0), "M"), group = year),
|
||||
stat = 'summary', fun = sum, size=2.3, vjust = -0.5
|
||||
) +
|
||||
guides(fill=guide_legend(nrow=3,byrow=TRUE))
|
||||
open_philanthropy_plot
|
||||
open_philanthropy_plot <- ggplot(data=df2, aes(x=year, y=amount, fill=area, group = cummulative_amount_for_its_area))+
|
||||
geom_bar(stat="identity")+
|
||||
labs(
|
||||
title=title_text,
|
||||
subtitle=subtitle_text,
|
||||
x=element_blank(),
|
||||
y=element_blank()
|
||||
) +
|
||||
# scale_fill_wsj() +
|
||||
# scale_fill_tableau(dir =1) +
|
||||
# scale_fill_tableau(palette, dir=direction) +
|
||||
# scale_fill_viridis(discrete = TRUE) +
|
||||
# scale_fill_brewer(palette = "Set2") +
|
||||
scale_fill_d3( "category20", alpha=0.8) +
|
||||
# scale_fill_uchicago("dark") +
|
||||
# scale_fill_startrek() +
|
||||
scale_y_continuous(labels = scales::dollar_format(scale = 0.000001, suffix = "M"), breaks = c(0:6)*10^8)+
|
||||
scale_x_continuous(breaks = years)+
|
||||
theme_tufte() +
|
||||
theme(
|
||||
legend.title = element_blank(),
|
||||
plot.title = element_text(hjust = 0.5),
|
||||
plot.subtitle = element_text(hjust = 0.5),
|
||||
legend.position="bottom",
|
||||
legend.box="vertical",
|
||||
axis.text.x=element_text(angle=60, hjust=1),
|
||||
legend.text=element_text(size=7, hjust = 0.5)
|
||||
) +
|
||||
geom_text(aes(label=ifelse(amount > 25e6, paste0(round(amount / 1e6, 0), "M"), "")), size = 2, position = position_stack(vjust = 0.5)) +
|
||||
geom_text(
|
||||
aes(label = paste0(round(after_stat(y) / 1e6, 0), "M"), group = year),
|
||||
stat = 'summary', fun = sum, size=2.2, vjust = -0.5
|
||||
) +
|
||||
guides(fill=guide_legend(nrow=3,byrow=TRUE))
|
||||
open_philanthropy_plot
|
||||
getwd() ## Working directory on which the file will be saved. Can be changed with setwd("/your/directory")
|
||||
height = 5
|
||||
width = 5
|
||||
ggsave(plot=open_philanthropy_plot, "open_philanthropy_grants_stacked_with_amounts.png", width=width, height=height, bg = "white")
|
||||
open_philanthropy_plot <- ggplot(data=df2, aes(x=year, y=amount, fill=area, group = cummulative_amount_for_its_area))+
|
||||
geom_bar(stat="identity")+
|
||||
labs(
|
||||
title=title_text,
|
||||
subtitle=subtitle_text,
|
||||
x=element_blank(),
|
||||
y=element_blank()
|
||||
) +
|
||||
# scale_fill_wsj() +
|
||||
# scale_fill_tableau(dir =1) +
|
||||
# scale_fill_tableau(palette, dir=direction) +
|
||||
# scale_fill_viridis(discrete = TRUE) +
|
||||
# scale_fill_brewer(palette = "Set2") +
|
||||
scale_fill_d3( "category20", alpha=0.8) +
|
||||
# scale_fill_uchicago("dark") +
|
||||
# scale_fill_startrek() +
|
||||
scale_y_continuous(labels = scales::dollar_format(scale = 0.000001, suffix = "M"), breaks = c(0:6)*10^8)+
|
||||
scale_x_continuous(breaks = years)+
|
||||
theme_tufte() +
|
||||
theme(
|
||||
legend.title = element_blank(),
|
||||
plot.title = element_text(hjust = 0.5),
|
||||
plot.subtitle = element_text(hjust = 0.5),
|
||||
legend.position="bottom",
|
||||
legend.box="vertical",
|
||||
axis.text.x=element_text(angle=60, hjust=1),
|
||||
legend.text=element_text(size=7, hjust = 0.5)
|
||||
) +
|
||||
geom_text(aes(label=ifelse(amount > 25e6, paste0(round(amount / 1e6, 0), "M"), ""), colour="white"), size = 2, position = position_stack(vjust = 0.5)) +
|
||||
geom_text(
|
||||
aes(label = paste0(round(after_stat(y) / 1e6, 0), "M"), group = year),
|
||||
stat = 'summary', fun = sum, size=2.2, vjust = -0.5
|
||||
) +
|
||||
guides(fill=guide_legend(nrow=3,byrow=TRUE))
|
||||
open_philanthropy_plot
|
||||
open_philanthropy_plot <- ggplot(data=df2, aes(x=year, y=amount, fill=area, group = cummulative_amount_for_its_area))+
|
||||
geom_bar(stat="identity")+
|
||||
labs(
|
||||
title=title_text,
|
||||
subtitle=subtitle_text,
|
||||
x=element_blank(),
|
||||
y=element_blank()
|
||||
) +
|
||||
# scale_fill_wsj() +
|
||||
# scale_fill_tableau(dir =1) +
|
||||
# scale_fill_tableau(palette, dir=direction) +
|
||||
# scale_fill_viridis(discrete = TRUE) +
|
||||
# scale_fill_brewer(palette = "Set2") +
|
||||
scale_fill_d3( "category20", alpha=0.8) +
|
||||
# scale_fill_uchicago("dark") +
|
||||
# scale_fill_startrek() +
|
||||
scale_y_continuous(labels = scales::dollar_format(scale = 0.000001, suffix = "M"), breaks = c(0:6)*10^8)+
|
||||
scale_x_continuous(breaks = years)+
|
||||
theme_tufte() +
|
||||
theme(
|
||||
legend.title = element_blank(),
|
||||
plot.title = element_text(hjust = 0.5),
|
||||
plot.subtitle = element_text(hjust = 0.5),
|
||||
legend.position="bottom",
|
||||
legend.box="vertical",
|
||||
axis.text.x=element_text(angle=60, hjust=1),
|
||||
legend.text=element_text(size=7, hjust = 0.5)
|
||||
) +
|
||||
geom_text(aes(label=ifelse(amount > 25e6, paste0(round(amount / 1e6, 0), "M"), "")), size = 2, colour="white", position = position_stack(vjust = 0.5)) +
|
||||
geom_text(
|
||||
aes(label = paste0(round(after_stat(y) / 1e6, 0), "M"), group = year),
|
||||
stat = 'summary', fun = sum, size=2.2, vjust = -0.5
|
||||
) +
|
||||
guides(fill=guide_legend(nrow=3,byrow=TRUE))
|
||||
open_philanthropy_plot
|
||||
open_philanthropy_plot <- ggplot(data=df2, aes(x=year, y=amount, fill=area, group = cummulative_amount_for_its_area))+
|
||||
geom_bar(stat="identity")+
|
||||
labs(
|
||||
title=title_text,
|
||||
subtitle=subtitle_text,
|
||||
x=element_blank(),
|
||||
y=element_blank()
|
||||
) +
|
||||
# scale_fill_wsj() +
|
||||
# scale_fill_tableau(dir =1) +
|
||||
# scale_fill_tableau(palette, dir=direction) +
|
||||
# scale_fill_viridis(discrete = TRUE) +
|
||||
# scale_fill_brewer(palette = "Set2") +
|
||||
scale_fill_d3( "category20", alpha=0.8) +
|
||||
# scale_fill_uchicago("dark") +
|
||||
# scale_fill_startrek() +
|
||||
scale_y_continuous(labels = scales::dollar_format(scale = 0.000001, suffix = "M"), breaks = c(0:6)*10^8)+
|
||||
scale_x_continuous(breaks = years)+
|
||||
theme_tufte() +
|
||||
theme(
|
||||
legend.title = element_blank(),
|
||||
plot.title = element_text(hjust = 0.5),
|
||||
plot.subtitle = element_text(hjust = 0.5),
|
||||
legend.position="bottom",
|
||||
legend.box="vertical",
|
||||
axis.text.x=element_text(angle=60, hjust=1),
|
||||
legend.text=element_text(size=7, hjust = 0.5)
|
||||
) +
|
||||
geom_text(aes(label=ifelse(amount > 25e6, paste0(round(amount / 1e6, 0), "M"), "")), size = 2, colour="#D3D3D3", position = position_stack(vjust = 0.5)) +
|
||||
geom_text(
|
||||
aes(label = paste0(round(after_stat(y) / 1e6, 0), "M"), group = year),
|
||||
stat = 'summary', fun = sum, size=2.2, vjust = -0.5
|
||||
) +
|
||||
guides(fill=guide_legend(nrow=3,byrow=TRUE))
|
||||
open_philanthropy_plot
|
||||
open_philanthropy_plot <- ggplot(data=df2, aes(x=year, y=amount, fill=area, group = cummulative_amount_for_its_area))+
|
||||
geom_bar(stat="identity")+
|
||||
labs(
|
||||
title=title_text,
|
||||
subtitle=subtitle_text,
|
||||
x=element_blank(),
|
||||
y=element_blank()
|
||||
) +
|
||||
# scale_fill_wsj() +
|
||||
# scale_fill_tableau(dir =1) +
|
||||
# scale_fill_tableau(palette, dir=direction) +
|
||||
# scale_fill_viridis(discrete = TRUE) +
|
||||
# scale_fill_brewer(palette = "Set2") +
|
||||
scale_fill_d3( "category20", alpha=0.8) +
|
||||
# scale_fill_uchicago("dark") +
|
||||
# scale_fill_startrek() +
|
||||
scale_y_continuous(labels = scales::dollar_format(scale = 0.000001, suffix = "M"), breaks = c(0:6)*10^8)+
|
||||
scale_x_continuous(breaks = years)+
|
||||
theme_tufte() +
|
||||
theme(
|
||||
legend.title = element_blank(),
|
||||
plot.title = element_text(hjust = 0.5),
|
||||
plot.subtitle = element_text(hjust = 0.5),
|
||||
legend.position="bottom",
|
||||
legend.box="vertical",
|
||||
axis.text.x=element_text(angle=60, hjust=1),
|
||||
legend.text=element_text(size=7, hjust = 0.5)
|
||||
) +
|
||||
geom_text(aes(label=ifelse(amount > 25e6, paste0(round(amount / 1e6, 0), "M"), "")), size = 2, colour="#C2C2C2", position = position_stack(vjust = 0.5)) +
|
||||
geom_text(
|
||||
aes(label = paste0(round(after_stat(y) / 1e6, 0), "M"), group = year),
|
||||
stat = 'summary', fun = sum, size=2.2, vjust = -0.5
|
||||
) +
|
||||
guides(fill=guide_legend(nrow=3,byrow=TRUE))
|
||||
open_philanthropy_plot
|
||||
getwd() ## Working directory on which the file will be saved. Can be changed with setwd("/your/directory")
|
||||
open_philanthropy_plot <- ggplot(data=df2, aes(x=year, y=amount, fill=area, group = cummulative_amount_for_its_area))+
|
||||
geom_bar(stat="identity")+
|
||||
labs(
|
||||
title=title_text,
|
||||
subtitle=subtitle_text,
|
||||
x=element_blank(),
|
||||
y=element_blank()
|
||||
) +
|
||||
# scale_fill_wsj() +
|
||||
# scale_fill_tableau(dir =1) +
|
||||
# scale_fill_tableau(palette, dir=direction) +
|
||||
# scale_fill_viridis(discrete = TRUE) +
|
||||
# scale_fill_brewer(palette = "Set2") +
|
||||
scale_fill_d3( "category20", alpha=0.8) +
|
||||
# scale_fill_uchicago("dark") +
|
||||
# scale_fill_startrek() +
|
||||
scale_y_continuous(labels = scales::dollar_format(scale = 0.000001, suffix = "M"), breaks = c(0:6)*10^8)+
|
||||
scale_x_continuous(breaks = years)+
|
||||
theme_tufte() +
|
||||
theme(
|
||||
legend.title = element_blank(),
|
||||
plot.title = element_text(hjust = 0.5),
|
||||
plot.subtitle = element_text(hjust = 0.5),
|
||||
legend.position="bottom",
|
||||
legend.box="vertical",
|
||||
axis.text.x=element_text(angle=60, hjust=1),
|
||||
legend.text=element_text(size=7, hjust = 0.5)
|
||||
) +
|
||||
geom_text(aes(label=ifelse(amount > 25e6, paste0(round(amount / 1e6, 0), "M"), "")), size = 2, colour="#D3D3D3", position = position_stack(vjust = 0.5)) +
|
||||
geom_text(
|
||||
aes(label = paste0(round(after_stat(y) / 1e6, 0), "M"), group = year),
|
||||
stat = 'summary', fun = sum, size=2.2, vjust = -0.5
|
||||
) +
|
||||
guides(fill=guide_legend(nrow=3,byrow=TRUE))
|
||||
open_philanthropy_plot
|
||||
getwd() ## Working directory on which the file will be saved. Can be changed with setwd("/your/directory")
|
||||
height = 5
|
||||
width = 5
|
||||
open_philanthropy_plot <- ggplot(data=df2, aes(x=year, y=amount, fill=area, group = cummulative_amount_for_its_area))+
|
||||
geom_bar(stat="identity")+
|
||||
labs(
|
||||
title=title_text,
|
||||
subtitle=subtitle_text,
|
||||
x=element_blank(),
|
||||
y=element_blank()
|
||||
) +
|
||||
# scale_fill_wsj() +
|
||||
# scale_fill_tableau(dir =1) +
|
||||
# scale_fill_tableau(palette, dir=direction) +
|
||||
# scale_fill_viridis(discrete = TRUE) +
|
||||
# scale_fill_brewer(palette = "Set2") +
|
||||
scale_fill_d3( "category20", alpha=0.8) +
|
||||
# scale_fill_uchicago("dark") +
|
||||
# scale_fill_startrek() +
|
||||
scale_y_continuous(labels = scales::dollar_format(scale = 0.000001, suffix = "M"), breaks = c(0:6)*10^8)+
|
||||
scale_x_continuous(breaks = years)+
|
||||
theme_tufte() +
|
||||
theme(
|
||||
legend.title = element_blank(),
|
||||
plot.title = element_text(hjust = 0.5),
|
||||
plot.subtitle = element_text(hjust = 0.5),
|
||||
legend.position="bottom",
|
||||
legend.box="vertical",
|
||||
axis.text.x=element_text(angle=60, hjust=1),
|
||||
legend.text=element_text(size=7, hjust = 0.5)
|
||||
) +
|
||||
geom_text(aes(label=ifelse(amount > 25e6, paste0(round(amount / 1e6, 0), "M"), "")), size = 2, colour="#f9f9f9", position = position_stack(vjust = 0.5)) +
|
||||
geom_text(
|
||||
aes(label = paste0(round(after_stat(y) / 1e6, 0), "M"), group = year),
|
||||
stat = 'summary', fun = sum, size=2.2, vjust = -0.5
|
||||
) +
|
||||
guides(fill=guide_legend(nrow=3,byrow=TRUE))
|
||||
open_philanthropy_plot
|
||||
open_philanthropy_plot <- ggplot(data=df2, aes(x=year, y=amount, fill=area, group = cummulative_amount_for_its_area))+
|
||||
geom_bar(stat="identity")+
|
||||
labs(
|
||||
title=title_text,
|
||||
subtitle=subtitle_text,
|
||||
x=element_blank(),
|
||||
y=element_blank()
|
||||
) +
|
||||
# scale_fill_wsj() +
|
||||
# scale_fill_tableau(dir =1) +
|
||||
# scale_fill_tableau(palette, dir=direction) +
|
||||
# scale_fill_viridis(discrete = TRUE) +
|
||||
# scale_fill_brewer(palette = "Set2") +
|
||||
scale_fill_d3( "category20", alpha=0.8) +
|
||||
# scale_fill_uchicago("dark") +
|
||||
# scale_fill_startrek() +
|
||||
scale_y_continuous(labels = scales::dollar_format(scale = 0.000001, suffix = "M"), breaks = c(0:6)*10^8)+
|
||||
scale_x_continuous(breaks = years)+
|
||||
theme_tufte() +
|
||||
theme(
|
||||
legend.title = element_blank(),
|
||||
plot.title = element_text(hjust = 0.5),
|
||||
plot.subtitle = element_text(hjust = 0.5),
|
||||
legend.position="bottom",
|
||||
legend.box="vertical",
|
||||
axis.text.x=element_text(angle=60, hjust=1),
|
||||
legend.text=element_text(size=7, hjust = 0.5)
|
||||
) +
|
||||
geom_text(aes(label=ifelse(amount > 25e6, paste0(round(amount / 1e6, 0), "M"), "")), size = 1.7, colour="#f9f9f9", position = position_stack(vjust = 0.5)) +
|
||||
geom_text(
|
||||
aes(label = paste0(round(after_stat(y) / 1e6, 0), "M"), group = year),
|
||||
stat = 'summary', fun = sum, size=2.2, vjust = -0.5
|
||||
) +
|
||||
guides(fill=guide_legend(nrow=3,byrow=TRUE))
|
||||
open_philanthropy_plot
|
||||
getwd() ## Working directory on which the file will be saved. Can be changed with setwd("/your/directory")
|
||||
height = 5
|
||||
width = 5
|
||||
ggsave(plot=open_philanthropy_plot, "open_philanthropy_grants_stacked_with_amounts.png", width=width, height=height, bg = "white")
|
||||
open_philanthropy_plot_lt <- ggplot(data=df4, aes(x=year, y=amount, fill=area, group=cummulative_amount_for_its_area))+
|
||||
geom_bar(stat="identity")+
|
||||
labs(
|
||||
title=title_text,
|
||||
subtitle=subtitle_text,
|
||||
x=element_blank(),
|
||||
y=element_blank()
|
||||
) +
|
||||
# scale_fill_wsj() +
|
||||
# scale_fill_tableau(dir =1) +
|
||||
# scale_fill_tableau(palette, dir=direction) +
|
||||
# scale_fill_viridis(discrete = TRUE) +
|
||||
# scale_fill_brewer(palette = "Set2") +
|
||||
scale_fill_d3( "category20", alpha=0.8) +
|
||||
# scale_fill_uchicago("dark") +
|
||||
# scale_fill_startrek() +
|
||||
scale_y_continuous(labels = scales::dollar_format(scale = 0.000001, suffix = "M"))+
|
||||
scale_x_continuous(breaks = years)+
|
||||
theme_tufte() +
|
||||
theme(
|
||||
legend.title = element_blank(),
|
||||
plot.title = element_text(hjust = 0.5),
|
||||
plot.subtitle = element_text(hjust = 0.5),
|
||||
legend.position="bottom",
|
||||
legend.box="vertical",
|
||||
axis.text.x=element_text(angle=60, hjust=1),
|
||||
legend.text=element_text(size=7)
|
||||
) +
|
||||
geom_text(aes(label=ifelse(amount > 5e6, paste0(round(amount / 1e6, 0), "M"), "")), size = 1.7, colour="#f9f9f9", position = position_stack(vjust = 0.5)) +
|
||||
geom_text(
|
||||
aes(label = paste0(round(after_stat(y) / 1e6, 0), "M"), group = year),
|
||||
stat = 'summary', fun = sum, size=2.3, vjust = -0.5
|
||||
) +
|
||||
guides(fill=guide_legend(nrow=3,byrow=TRUE))
|
||||
open_philanthropy_plot_lt
|
||||
getwd() ## Working directory on which the file will be saved. Can be changed with setwd("/your/directory")
|
||||
height = 5
|
||||
width = 6
|
||||
## open_philanthropy_plot_lt
|
||||
ggsave(plot=open_philanthropy_plot_lt, "open_philanthropy_grants_lt_labeled.png", width=width, height=height, bg = "white")
|
||||
open_philanthropy_plot_lt <- ggplot(data=df4, aes(x=year, y=amount, fill=area, group=cummulative_amount_for_its_area))+
|
||||
geom_bar(stat="identity")+
|
||||
labs(
|
||||
title=title_text,
|
||||
subtitle=subtitle_text,
|
||||
x=element_blank(),
|
||||
y=element_blank()
|
||||
) +
|
||||
# scale_fill_wsj() +
|
||||
# scale_fill_tableau(dir =1) +
|
||||
# scale_fill_tableau(palette, dir=direction) +
|
||||
# scale_fill_viridis(discrete = TRUE) +
|
||||
# scale_fill_brewer(palette = "Set2") +
|
||||
scale_fill_d3( "category20", alpha=0.8) +
|
||||
# scale_fill_uchicago("dark") +
|
||||
# scale_fill_startrek() +
|
||||
scale_y_continuous(labels = scales::dollar_format(scale = 0.000001, suffix = "M"))+
|
||||
scale_x_continuous(breaks = years)+
|
||||
theme_tufte() +
|
||||
theme(
|
||||
legend.title = element_blank(),
|
||||
plot.title = element_text(hjust = 0.5),
|
||||
plot.subtitle = element_text(hjust = 0.5),
|
||||
legend.position="bottom",
|
||||
legend.box="vertical",
|
||||
axis.text.x=element_text(angle=60, hjust=1),
|
||||
legend.text=element_text(size=7)
|
||||
) +
|
||||
geom_text(aes(fill="#f9f9f9", label=ifelse(amount > 5e6, paste0(round(amount / 1e6, 0), "M"), "")), size = 1.7, position = position_stack(vjust = 0.5)) +
|
||||
geom_text(
|
||||
aes(label = paste0(round(after_stat(y) / 1e6, 0), "M"), group = year),
|
||||
stat = 'summary', fun = sum, size=2.3, vjust = -0.5
|
||||
) +
|
||||
guides(fill=guide_legend(nrow=3,byrow=TRUE))
|
||||
open_philanthropy_plot_lt
|
||||
open_philanthropy_plot_lt <- ggplot(data=df4, aes(x=year, y=amount, fill=area, group=cummulative_amount_for_its_area))+
|
||||
geom_bar(stat="identity")+
|
||||
labs(
|
||||
title=title_text,
|
||||
subtitle=subtitle_text,
|
||||
x=element_blank(),
|
||||
y=element_blank()
|
||||
) +
|
||||
# scale_fill_wsj() +
|
||||
# scale_fill_tableau(dir =1) +
|
||||
# scale_fill_tableau(palette, dir=direction) +
|
||||
# scale_fill_viridis(discrete = TRUE) +
|
||||
# scale_fill_brewer(palette = "Set2") +
|
||||
scale_fill_d3( "category20", alpha=0.8) +
|
||||
# scale_fill_uchicago("dark") +
|
||||
# scale_fill_startrek() +
|
||||
scale_y_continuous(labels = scales::dollar_format(scale = 0.000001, suffix = "M"))+
|
||||
scale_x_continuous(breaks = years)+
|
||||
theme_tufte() +
|
||||
theme(
|
||||
legend.title = element_blank(),
|
||||
plot.title = element_text(hjust = 0.5),
|
||||
plot.subtitle = element_text(hjust = 0.5),
|
||||
legend.position="bottom",
|
||||
legend.box="vertical",
|
||||
axis.text.x=element_text(angle=60, hjust=1),
|
||||
legend.text=element_text(size=7)
|
||||
) +
|
||||
geom_text(aes(label=ifelse(amount > 5e6, paste0(round(amount / 1e6, 0), "M"), "")), size = 1.7, position = position_stack(vjust = 0.5)) +
|
||||
geom_text(
|
||||
aes(label = paste0(round(after_stat(y) / 1e6, 0), "M"), group = year),
|
||||
stat = 'summary', fun = sum, size=2.3, vjust = -0.5
|
||||
) +
|
||||
guides(fill=guide_legend(nrow=3,byrow=TRUE))
|
||||
open_philanthropy_plot_lt
|
||||
open_philanthropy_plot_lt <- ggplot(data=df4, aes(x=year, y=amount, fill=area, group=cummulative_amount_for_its_area))+
|
||||
geom_bar(stat="identity")+
|
||||
labs(
|
||||
title=title_text,
|
||||
subtitle=subtitle_text,
|
||||
x=element_blank(),
|
||||
y=element_blank()
|
||||
) +
|
||||
# scale_fill_wsj() +
|
||||
# scale_fill_tableau(dir =1) +
|
||||
# scale_fill_tableau(palette, dir=direction) +
|
||||
# scale_fill_viridis(discrete = TRUE) +
|
||||
# scale_fill_brewer(palette = "Set2") +
|
||||
scale_fill_d3( "category20", alpha=0.8) +
|
||||
# scale_fill_uchicago("dark") +
|
||||
# scale_fill_startrek() +
|
||||
scale_y_continuous(labels = scales::dollar_format(scale = 0.000001, suffix = "M"))+
|
||||
scale_x_continuous(breaks = years)+
|
||||
theme_tufte() +
|
||||
theme(
|
||||
legend.title = element_blank(),
|
||||
plot.title = element_text(hjust = 0.5),
|
||||
plot.subtitle = element_text(hjust = 0.5),
|
||||
legend.position="bottom",
|
||||
legend.box="vertical",
|
||||
axis.text.x=element_text(angle=60, hjust=1),
|
||||
legend.text=element_text(size=7)
|
||||
) +
|
||||
geom_text(aes(label=ifelse(amount > 5e6, paste0(round(amount / 1e6, 0), "M"), "")), size = 1.7, colour="#f9f9f9", position = position_stack(vjust = 0.5)) +
|
||||
geom_text(
|
||||
aes(label = paste0(round(after_stat(y) / 1e6, 0), "M"), group = year),
|
||||
stat = 'summary', fun = sum, size=2.3, vjust = -0.5
|
||||
) +
|
||||
guides(fill=guide_legend(nrow=3,byrow=TRUE))
|
||||
open_philanthropy_plot_lt
|
||||
open_philanthropy_plot_lt <- ggplot(data=df4, aes(x=year, y=amount, fill=area, group=cummulative_amount_for_its_area))+
|
||||
geom_bar(stat="identity")+
|
||||
labs(
|
||||
title=title_text,
|
||||
subtitle=subtitle_text,
|
||||
x=element_blank(),
|
||||
y=element_blank()
|
||||
) +
|
||||
# scale_fill_wsj() +
|
||||
# scale_fill_tableau(dir =1) +
|
||||
# scale_fill_tableau(palette, dir=direction) +
|
||||
# scale_fill_viridis(discrete = TRUE) +
|
||||
# scale_fill_brewer(palette = "Set2") +
|
||||
scale_fill_d3( "category20", alpha=0.8) +
|
||||
# scale_fill_uchicago("dark") +
|
||||
# scale_fill_startrek() +
|
||||
scale_y_continuous(labels = scales::dollar_format(scale = 0.000001, suffix = "M"))+
|
||||
scale_x_continuous(breaks = years)+
|
||||
theme_tufte() +
|
||||
theme(
|
||||
legend.title = element_blank(),
|
||||
plot.title = element_text(hjust = 0.5),
|
||||
plot.subtitle = element_text(hjust = 0.5),
|
||||
legend.position="bottom",
|
||||
legend.box="vertical",
|
||||
axis.text.x=element_text(angle=60, hjust=1),
|
||||
legend.text=element_text(size=7)
|
||||
) +
|
||||
geom_text(aes(label=ifelse(amount > 5e6, paste0(round(amount / 1e6, 0), "M"), "")), size = 2, colour="#f9f9f9", position = position_stack(vjust = 0.5)) +
|
||||
geom_text(
|
||||
aes(label = paste0(round(after_stat(y) / 1e6, 0), "M"), group = year),
|
||||
stat = 'summary', fun = sum, size=2.3, vjust = -0.5
|
||||
) +
|
||||
guides(fill=guide_legend(nrow=3,byrow=TRUE))
|
||||
open_philanthropy_plot_lt
|
||||
getwd() ## Working directory on which the file will be saved. Can be changed with setwd("/your/directory")
|
||||
height = 5
|
||||
width = 6
|
||||
## open_philanthropy_plot_lt
|
||||
ggsave(plot=open_philanthropy_plot_lt, "open_philanthropy_grants_lt_labeled.png", width=width, height=height, bg = "white")
|
|
@ -129,10 +129,10 @@ open_philanthropy_plot <- ggplot(data=df2, aes(x=year, y=amount, fill=area, grou
|
|||
axis.text.x=element_text(angle=60, hjust=1),
|
||||
legend.text=element_text(size=7, hjust = 0.5)
|
||||
) +
|
||||
geom_text(aes(label=ifelse(amount > 25e6, paste(round(amount / 1e6, 0), "M"), "")), size = 2, position = position_stack(vjust = 0.5)) +
|
||||
geom_text(aes(label=ifelse(amount > 25e6, paste0(round(amount / 1e6, 0), "M"), "")), size = 1.7, colour="#f9f9f9", position = position_stack(vjust = 0.5)) +
|
||||
geom_text(
|
||||
aes(label = paste(round(after_stat(y) / 1e6, 0), "M"), group = year),
|
||||
stat = 'summary', fun = sum, size=2, vjust = -0.5
|
||||
aes(label = paste0(round(after_stat(y) / 1e6, 0), "M"), group = year),
|
||||
stat = 'summary', fun = sum, size=2.2, vjust = -0.5
|
||||
) +
|
||||
guides(fill=guide_legend(nrow=3,byrow=TRUE))
|
||||
|
||||
|
@ -279,10 +279,10 @@ open_philanthropy_plot_lt <- ggplot(data=df4, aes(x=year, y=amount, fill=area, g
|
|||
axis.text.x=element_text(angle=60, hjust=1),
|
||||
legend.text=element_text(size=7)
|
||||
) +
|
||||
geom_text(aes(label=ifelse(amount > 5e6, paste(round(amount / 1e6, 0), "M"), "")), size = 2, position = position_stack(vjust = 0.5)) +
|
||||
geom_text(aes(label=ifelse(amount > 5e6, paste0(round(amount / 1e6, 0), "M"), "")), size = 2, colour="#f9f9f9", position = position_stack(vjust = 0.5)) +
|
||||
geom_text(
|
||||
aes(label = paste(round(after_stat(y) / 1e6, 0), "M"), group = year),
|
||||
stat = 'summary', fun = sum, size=2, vjust = -0.5
|
||||
aes(label = paste0(round(after_stat(y) / 1e6, 0), "M"), group = year),
|
||||
stat = 'summary', fun = sum, size=2.3, vjust = -0.5
|
||||
) +
|
||||
guides(fill=guide_legend(nrow=3,byrow=TRUE))
|
||||
open_philanthropy_plot_lt
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 104 KiB |
Binary file not shown.
Before Width: | Height: | Size: 118 KiB After Width: | Height: | Size: 116 KiB |
Loading…
Reference in New Issue
Block a user