1.13 Colormap for Map Data

Summary

This Colormap for Map Data app can be used to create a map with the Shapefile data and fill each region with colors mapping to specified values. This tutorial will show you how to plot a US map of 2016 Olympic game medals distribution over each state.

Tutorial

Notes:

This tutorial requires both Colormap for Map Data App and Import Shapefile App to be installed.

1. Import Shapefile Data

  1. Find out Colormap for Map Data app in Apps gallery (docked to the right of Origin workspace), right click on it and select Show Samples Folder. Under the folder there are 3 files: cb_2015_us_state_20m.zip, US_medals.ogw, and colormap_US_medals.opj. Unzip cb_2015_us_state_20m.zip to 8 files and among them there’s one Shapefile (.shp file). Shapefile is a popular data format for storing map data. Origin has provided the Import Shapefile app for importing such data.
  2. Go back to Origin, create a new project by File: New: Project. Then in the Apps gallery, click the Import Shapefile app to bring up the import dialog.
  3. Within the dialog,
    • select the .shp file unzipped in step 1
    • check Auto checkbox of both File Name (attribute) and File Name (projection)
    • make sure Output Data Points checkbox is checked.
    • clear Graph checkbox
    keep other settings the default values. Click OK to import. Colormap for Map Data 1.png

2. Reorder Shapefile Data

  1. Go to Book2 where the shapefile data is imported. Click the Colormap for Map Data app from the Apps Gallery. A toolbar with 2 buttons shows up.
  2. Click the 1st button to bring up the ReorderShapefileData dialog. Select NAME column (col(J)) for Names for ID, by clicking on Colormap for Map Data 2 1.png button.
    Colormap for Map Data 2.png
  3. Click OK to reorder the data based on state NAME.
    In the output worksheet Shapefile Data Reordered, there are 6 columns. The first 2 columns are the longitude and latitude of the map data respectively. You can put "Longitude" and "Latitude" to Long Name of column A and B. The 3rd column is the state ID that each coordinate corresponds to, and the 4th column is the ID of each state (5th column). If Names for ID is not specified in step 2, the 5th column will be empty. The last column is now empty, which is used to fill the values for mapping colors.
    Colormap for Map Data 3.png

3. Create Map with Colormap of Specified Data

  1. Drag and drop US_medals.ogw file from the App sample folder into Origin’s workspace. A workbook, Book3 containing the US medal data is generated.
  2. Activate worksheet [Book2]"Shapefile Data Reordered". Highlight the Value column (col(F)) and select Column:Set Column Values…
  3. In the Set Values dialog, type the following formula below Col(F)= :
    lookup(E,[Book3]Sheet1!A,[Book3]Sheet1!B,2)

    This will map the state medal numbers referring to the state column in this worksheet.

  4. With Book2 activated, click the 2nd button of the app’s toolbar, a graph of the map data is created. The color on the graph is now mapped to number of medals in column F, also the related labels are added to the corresponding regions. Colormap for Map Data 4.png

4. Customize the Graph

  1. Go to worksheet Shapefile Data Reordered, change the comments of column G to "Medals".
    Colormap for Map Data 5.png
  2. Go to the created graph. Double click on the X axis to bring up the Axis dialog.
    • On Scale tab, set From = -130, and To = -60.
    • Select Vertical from the left panel, and set From = 20 and To = 55.

    Colormap for Map Data 5 2.png
  3. Under tabs Tick Labels, Title, Line and Ticks for bottom and left axis, clear Show checkbox. Click OK.
  4. Double click the plot to bring up the Plot Details dialog. Highlight Layer1 in the left panel. Go to the Size/Speed tab, check Link Axis Length to Scale with X:Y Ratio 1. Click Apply. This makes sure the map isn’t distorted.
    Colormap for Map Data 6.png
  5. To customize colormap levels and colors, select Plot on the left panel. Go to the Colormap tab in the right panel. Click on the Level header of the table to bring up the Set Levels dialog. In this dialog, set From = 1 and To = 60. Check # Major Levels and input 6 for it. Click OK back to Plot Details dialog.
    Colormap for Map Data 7.png
  6. Click the Fill header of the table to bring up the Fill dialog. Check Load Palette and select BlueYellow. Check Flip Palette. Click OK.
    Colormap for Map Data 8.png
  7. Double click on the color scale to bring up the Color Scale Control dialog. In the dialog,
    • select Levels from the left panel, check Hide Head and Tail Levels.
    • select Labels from the left, under Display, uncheck Auto. Check Set Decimal Places checkbox and input 0 for Decimal Places.
    • select Layout from the left, set Layout to Separated.
    • select Title from the left, check Show checkbox in the right panel
    Click OK button. You can move and resize the color scale as desired.
    Colormap for Map Data 9.png
  8. As the final step, we are going to add Alaska and Hawaii to the graph. Activate the graph, click the duplicate button in the top tool bar twice to make two copies.
    Colormap for Map Data 10.png
  9. In the first copied graph, delete the color scale. Select Format: Axis: X Axis…. With Horizontal selected in the left panel, under the Scale tab, set the From = -195 and To = -125. Then select Vertical in the left, set From = 50 and To = 75. Click OK. Alaska is now shown in this graph.
    Colormap for Map Data 11.png
  10. Repeat previous step for the second graph copy. Set the Horizontal scale as From -195 To -120 and Vertical scale as From 5 To 30.
    Colormap for Map Data 12.png
  11. Click merge button in the right side tool bar. In the Merge Graph dialog,
    • Click ... button besides Graphs to open up the graph browser. Select all 3 graphs in the left panel and click >> button to move them to the right and then click OK to add them.
    • Set Number of Rows and Number of Columns to 1.
    • Make sure Link Source Graphs is unchecked.
    Click OK.
    Colormap for Map Data 13.png
  12. In the generated merged graph, move and resize the layer for Alaska and Hawaii as desired for better display.
    Colormap for Map Data 14.png