Rで何かをしたり、読書をするブログ

政府統計の総合窓口のデータや、OECDやUCIやのデータを使って、Rの練習をしています。ときどき、読書記録も載せています。

OECD Meat Consumption Data Analysis 5 - scatter plot using R ggplot2::geom_point()

f:id:cross_hyou:20210918164320j:plain

Photo by Casey Horner on Unsplash 

www.crosshyou.info

This post is following of above post.
In this post, let's draw scatter plots using R ggplot2::geom_point.
First of all, let's see correlations about 4 KG_CAPs.

f:id:cross_hyou:20210918164528p:plain

bekg: BEEF KG_CAP and pokg: POULTRY KG_CAP are the most strongly correlated pair.

pikg: PIG KG_CAP and shkg: SHEEP KG_CAP are the least weakly correlated pair.

Then, let's draw scatter plots. 
First, bekg: BEEF KG_CAP and pikg: PIG KG_CAP

f:id:cross_hyou:20210918164914p:plain

f:id:cross_hyou:20210918165123p:plain

We see some countries seems have negative correlation.

Let's see bekg and pokg: POULTRY KG_CAP

f:id:cross_hyou:20210918165308p:plain

f:id:cross_hyou:20210918165318p:plain

How about bekg and shkg: SHEEP KG_CAP?

f:id:cross_hyou:20210918165453p:plain

f:id:cross_hyou:20210918165503p:plain

Many countries have relatively low value for shkg compared to bekg.

pikg and pokg

f:id:cross_hyou:20210918170418p:plain

f:id:cross_hyou:20210918170429p:plain

 

pikg and shkg

f:id:cross_hyou:20210918170113p:plain

f:id:cross_hyou:20210918170123p:plain

Lastly, pokg and shkg

f:id:cross_hyou:20210918170555p:plain

f:id:cross_hyou:20210918170606p:plain

Now, we have 6 scatter plot objects, p1 ~ p6.
Let's show it at once. we use gridExtra::grid.arrange() function.

f:id:cross_hyou:20210918170758p:plain

f:id:cross_hyou:20210918170829p:plain

That's it. Thank you!

Next post is

 

www.crosshyou.info

 

To read the 1st post,

 

www.crosshyou.info