513 lines
19 KiB
R
513 lines
19 KiB
R
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")
|