AntoineSoetewey / statsandr

A blog on statistics and R aiming at helping academics and professionals working with data to grasp important concepts in statistics and to apply them in R. See www.statsandr.com
http://statsandr.com/
35 stars 16 forks source link

blog/world-map-of-visited-countries-in-r/ #37

Closed utterances-bot closed 3 years ago

utterances-bot commented 3 years ago

World map of visited countries in R - Stats and R

This article illustrates how to draw a world map of the countries you have visited in R. This world map can also be used to highlight some specific countries

https://statsandr.com/blog/world-map-of-visited-countries-in-r/

AntoineSoetewey commented 3 years ago

Comment written by Pete Phillips on July 28, 2020 20:52:45:

Hi Antoine.

Any idea how you can ONLY plot the main country on its own rather than its dependencies ?

So for example, to plot mainland Spain without plotting Corsica and New Caledonia for example ? The ISO 3166 seems to have that granularity but can't see any way to link that to the maps data.

Cheers Pete

AntoineSoetewey commented 3 years ago

Comment written by Pete Phillips on July 28, 2020 20:52:45:

Hi Antoine.

Any idea how you can ONLY plot the main country on its own rather than its dependencies ?

So for example, to plot mainland Spain without plotting Corsica and New Caledonia for example ? The ISO 3166 seems to have that granularity but can't see any way to link that to the maps data.

Cheers Pete

Comment written by Antoine Soetewey on July 28, 2020 23:05:46:

Good question Pete!

Actually I couldn't find a quick fix before posting this article, so I didn't look further.

I just had another look and it seems to me that the problem may come from the fact that the data from highcharts does not have the same level of granularity than the ISO 3166 data.

In any case, I would be interested to know if you find a solution!

Best,
Antoine

AntoineSoetewey commented 3 years ago

Comment written by Mansi Shah on December 15, 2020 20:50:13:

Is there a way to make the color of the countries different, depending on another variable with different levels? For example, instead of just "visited" and "not visited", if I want to do "visited", "traveled through", and "heard about"

AntoineSoetewey commented 3 years ago

Comment written by Mansi Shah on December 15, 2020 20:50:13:

Is there a way to make the color of the countries different, depending on another variable with different levels? For example, instead of just "visited" and "not visited", if I want to do "visited", "traveled through", and "heard about"

Dear Mansi,

Sorry for my very late reply.

I have not tried it, but according to this example, yes it seems to be possible.

Feel free to send me your map if you implement it.

Regards, Antoine