File:Historical forex reserves.png

Original file (2,890 × 1,643 pixels, file size: 157 KB, MIME type: image/png)

Summary

Description
English: Source: [1] On the right under "Download", click on CSV.

The following the R code was used to generate the image, after some cleanup of the CSV:

library(dplyr)
library(tidyr)
library(ggplot2)

# prepare data in long form
reserves = read.csv("reserves.csv") %>%
  rename(Country = 1) %>%  # Rename the first column to "Country"
  pivot_longer(
    cols = starts_with("X"),
    names_to = "Year",
    values_to = "Reserves"
  ) %>%
  mutate(
    Year = as.numeric(sub("^X", "", Year)),  # Clean and convert Year
    Country = factor(Country, levels = c(
      "China", "Japan", "Switzerland", 
      "United States", "India", "Russia"  # Custom country order
    ))
  )

# for finding top countries
reserves.2023 = reserves %>% filter(Year==2023)

# dark theme
my.theme = theme(plot.title = element_text(size=25, family="serif",color='#e6e6e6',hjust=.5),
                 axis.text = element_text(color='#bfbfbf'),
                 axis.title.x = element_blank(),
                 axis.title.y = element_text(size=15, face="bold",color='#e6e6e6'),
                 legend.title = element_text(size=15, face="bold",color='#e6e6e6',hjust=.5),
                 legend.background = element_blank(),
                 legend.text = element_text(color='#e6e6e6',size=12),
                 panel.background = element_rect(fill = '#202020', color = '#404040'),
                 plot.background = element_rect(fill = '#181818', color = '#404040'),
                 panel.grid.minor = element_blank(), 
                 panel.grid.major = element_line(color='#404040'),
                 plot.margin = unit(c(.5,.8,.5,.8), "cm"))

# graph with US
ggplot(reserves, aes(x=Year, y=Reserves/10^9, fill=Country)) +
  geom_area(alpha=1) +
  scale_x_continuous(breaks = seq(2000,2023, by=5)) +
  labs(title="Historical forex reserves (including gold)",
       x="Year", y="Reserves (billions USD)") +
  my.theme
# ggsave("Historical forex reserves.png") # disabled for now

# graph without US
reserves.CJSIR = reserves %>% filter(Country != "United States")

ggplot(reserves.CJSIR, aes(x=Year, y=Reserves/10^9, fill=Country)) +
  geom_area(alpha=1) +
  scale_x_continuous(breaks = seq(2000,2023, by=5)) +
  labs(title="Historical forex reserves (including gold)",
       x="Year", y="Reserves (billions USD)") +
  my.theme

ggsave("Historical forex reserves.png")
Date
Source Own work
Author Wizmut

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

  1. Total reserves (includes gold, current US$). World Bank. Retrieved on 24 November 2024.

Captions

Foreign exchange reserves for the top 5 countries

Items portrayed in this file

depicts

24 November 2024

image/png

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current20:17, 24 November 2024Thumbnail for version as of 20:17, 24 November 20242,890 × 1,643 (157 KB)WizmutUploaded own work with UploadWizard

The following page uses this file:

Metadata