Showing posts with label Data visualization. Show all posts
Showing posts with label Data visualization. Show all posts

Friday, July 27, 2018

Fun fact about Singapore's time zone

A fun fact which I noticed, but haven't thought about until now 
According to this map, Singapore is in the "wrong" time zone: Since she's westward of VN, the time zone should be one hour lag to SG's. 
The short answer I found in the net is "Sometime in 1981, Malaysia declared that West / Peninsular Malaysia would move their clocks ahead by 30 min to match the time in use in East Malaysia (8 hrs ahead of GMT). This meant that Singapore would be in a rather awkward position in time if she didn't follow suit, especially with the amount of traffic and trade across the causeway." (https://www.quora.com/Why-do-Peninsular-Malaysia-and-Singap…
East Malay is in the same time zone as Perth.
Perth is eastward of VN, so she leads one hour.


Friday, February 16, 2018

Vietnam interactive map with R (part 2)

This is the update on the Vietnam choropleth map from the previous post. I thank Loan Vu for providing me with the VHLSS data.

This map presents average annual household income from two sources : "Employment" (primary and secondary jobs-related) and "Agriculture" (a sum of income from "Cultivation", "Animal Husbandry" and "Agricultural, Forestry and Aquaculture" sources). The total income is shown in this. The updates are:
  • I provide values converted to $US here, rather than in VND as before (although doing this disregard purchasing power parity altogether!). 
  • A toggle button to select income types, plus a legend for each variable, are added.
  • As before, map is zoom-able. The min and max zoom parameters are slightly changed.
I haven't figured out how to add more than 2 layers without significantly reduce the loading time (not that the current loading time is that impressive!). Additionally, to make it more interactive, the legends should be toggled together with the map layers. I did write a better UI with Shiny, but publishing it requires premium account for Rstudio. Hopefully I can do more tinkering in the future, maybe after finishing my studies.

Disclaimer:  The information on this map was derived from digital databases from OpenStreetMap. OpenStreetMap is open data, licensed under the Open Data Commons Open Database License (ODbL) by the OpenStreetMap Foundation (OSMF). The map tile used is licenced as CC BY-SA.  For more about copyright, please see https://www.openstreetmap.org/copyright 

Sunday, February 4, 2018

Vietnam interactive map with R

 

This is my first attempt at drawing an interactive map with leaflet, created by the Rstudio team (a nice introduction to the package, which I follow to create this map, can be found here). Quite a bit of data involved, so the map might load rather slowly.
The data are from the Vietnam Household Living Standard Survey (VHLSS), 2014 round. They are available for purchase from the Vietnam's General Statistics Office. Here I only use income data ("Muc 4"). I aggregated the multiple income sources at the household level (summing across all family members), and take the unweighted mean of income across all households surveyed in each province.

  • The gradient color scaling is based on the magnitude of the mean income from all sources. The darker the color scheme, the more affluence the average household there.
  • To see the underlying data for the provinces, hover your mouse over the corresponding provinces. Keep in mind that this is only a prototype. I'm planning to break the map into layers (each shows one category of income) and better representations.
  • Zoom in using mouse scroll or the buttons on the left. Click, hold and drag left mouse to refocus.
Feel free to contact me for details.

Thursday, December 7, 2017

International Comparison Program 2011 results

Playing around with excel bubble plot, and ICP data http://siteresources.worldbank.org/…/Resources/ICP_2011.html
Things are likely to be more expensive in richer countries, but not always. Market exchange rates tend to underestimate income.
 

Friday, July 21, 2017

Interactive Trade Flows Chord Diagram (with R)

Chord Diagram is becoming more and more popular in offering an elegant way to capture the complexity of big data, and more so if you can make them "user-driven", i.e. interactive. This post suggests a few tips to do it.

 

After one full day tinkering with Javascripts I was able to produce a very nice interactive plot using the 2013 East Asian intra-regional export flows data provided by one of my fellow PhD students at UWA (Son Nguyen) and the code in the developing R package "chorddiag". I got great help from Son in publishing this plot also.
Note that different from the one-way diagram in my previous post, here the chords are bi-directional, and their colors match those countries with lower bilateral export values, which are also at the smaller ends of these chords. That is, each chord represents a trade deficit for the colored countries. Not the best arrangement I'd say, since it would feel more natural to have the chord colors matched with countries with larger export (to give more of a "flowing" feel?), as shown in a very similar plot (for Australian trade data only) featured in a recent blog by World Bank's Siddhesh Kaushik. For more prominent Javascript developers, there is a blog showing how to create a trade diagram directly with D3 here

Wednesday, July 19, 2017

Migration Chord Diagram

This is the plot done using Guy Abel's code in his "migest" R package. It shows the average inter- and intra-regional flows of migration from 2005 to 2010, based on place of birth data. Unit is in millions. The arrows indicate direction of flows (as do their colors), while their sizes indicate the magnitude of flows. The width of a region's arch indicates the total migration flow for that region. It seems that accept for Latin America & Caribbean, intra- dominates inter-regional migration in this 5-year period. I will probably use this setting to plot a similar figure with my bilateral trade cost data in the future.

See more about the guiding steps in Guy's blog here and the blog of his co-author Nikola Sander here. The full data (with country-level data) as well as an visually stunning interactive figure are accessible in the authors' migration project home page.


Update: After one day tinkering I was able to produce an interactive plot of bilateral export flows, using the 2013 East Asian intra-regional data provided by one of my fellow PhD Student at UWA (Son Nguyen) and the code in the developing R package "chorddiag". There is an issue with the colors, as they don't show up properly in some computers. See the plot in my subsequent blog here, or on Rstudio live server at http://rpubs.com/ranma1202/292965


Monday, June 26, 2017

3d plot of the globe (plotted by R "rgl" package)

RGL model
.

Drag mouse to rotate model. Use mouse wheel or middle button to zoom it.

Object written from rgl 0.98.1 by writeWebGL.