Plotting COVID-19 Epidemic

In this post, we will visualize spread of worldwide COVID-19 cases through time. I obtained the data from Rami Krispin’s website: using coronovirus package. I also decided to do some experimentation using John Coene’s fantastic echarts4r package, which allows us to access echarts API. Load the libraries and get the data in the R session. library(dplyr) library(echarts4r) library(coronavirus) # Get the data data("coronavirus") Data Preparation Check out the first 6 observations.

Top 10 Nations Dumping Plastic in the Oceans

I came across this Science article someone shared on Twitter: Plastic waste inputs from land in to the ocean In this post I am going to make a bar graph using the top 10 countries listed in Table 1. Here is the screenshot of that table. The ranking in the table is based on the last column. As that column shows interval estimates, I decided use the midpoints of those intervals.

Correlation between Indian and US Stock Markets

I invest (modestly) in both US and Indian stock markets. For the last few days I observed that on the days when US market was down, the Indian market was not necessarily down. This is somewhat unexpected given my past experience (I used to work in the financial sector back in India). When I posted my observation on Facebook, people asked me for more concrete evidence for a lack of this correlation.

Color Palettes

The colors are from WSJ article I will use the colors extracted from the solid bar at the bottom of the image. How did I do that? I used ColorZilla addon for Firefox: Here are the hex codes for 7 colors I extracted:

Create a color palette from WSJ article wsjPal <- c('#65C1E8', '#D85B63', '#D680AD', '#5C5C5C', '#C0BA80', '#FDC47D', '#EA3B46') Try out a graph using the new color palette

Extending ggplot2

There are numerous ways in which you can extend ggplot2 package. In this post, I am going to talk about 3 packages that are relevant to us immediately. Extrafont The first package is extrafont, which enables importing font files from your computer to R. You will have to do this only once after you install the package and then in future whenever you want to use different fonts, you can simply call them by name in ggplot2.