Visualization

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 https://www.wsj.com/articles/the-kavanaugh-effect-political-debates-shake-up-the-workplace-1538949970 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: https://addons.mozilla.org/en-US/firefox/addon/colorzilla/ 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.