Colormap with Specified Values for Map Data Plot


Shapefile is a popular data format for storing map data. Origin has provided an app, Import Shapefile, for importing such data. After importing, Origin is able to create a map with the data. If one needs to fill each region with colors mapping to specified values, a new app Colormap for Map Data is published for Origin 2017 for this purpose. This example shows the distribution of 2016 Olympic game medals over each US state.


Step 1. Import Shapefile Data

  1. First of all, install the two apps, Import Shapefile and Colormap for Map Data, into Origin 2017.
  2. In Origin’s Apps gallery, find out Colormap for Map Data app, right click on it and select Show sample Folder.  Under the folder there are three files:, US_medals.ogw, and colormap_US_medals.opj. Unzip to 8 files and among them there’s one .shp file.
  3. Go back to Origin, create a new project by File: New: New Project. Then in the Apps gallery, click the Import Shapefile app to bring up the import dialog.
  4. Within the dialog, select the .shp file unzipped in step 2. Check the Auto checkbox of both File Name (attribute) and File Name (projection), also make sure Output Data Points checkbox is checked. Clear the Graph checkbox, and keep other settings the default values. Click OK to import.

Step 2. Reorder Shapefile Data

  1. Go to the workbook where the shapefile data is imported. Click the Colormap for Map Data app from the Apps gallery. A toolbar with two buttons shows up.
  2. Click the first button to bring up the ReorderShapefileData dialog. Select NAME column (column J) for Names for ID, by clicking on the triangle button to this control.
  3. Click OK button to reorder the data based on State Name.
    In the output worksheet, there are six columns. The first two 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 third column is the state ID that each coordinate corresponds to, and the fourth column is the ID of each state (fifth column). If Names for ID is not specified in step 2, the fifth column will be empty. The last column is now empty, which is used to fill the values for mapping colors.

Step 3. Create Map with Colormap of Specified Data

  1. Drag and drop US_medals.ogw file from the sample folder into Origin’s workspace. A workbook with name Book3 containing the US medal data is generated.
  2. Go back to the worksheet with the reordered data. Highlight the Value column (column F) and select Column:Set Column Values…
  3. In the Set Values dialog, type the following formula below Col(F)= :

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

  4. With this workbook activated, click the second 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.

Step 4. Customize the Graph

  1. Go to the worksheet with the reordered data, change the comments of the column with green lock (column G) to Medals.
  2. Go to the created graph. Double click on the X axis to bring up the Axis dialog. Under the Scale tab, set From as -130, and To as -60. Then select Vertical from the left panel, and set From and To as 20 and 55 respectively.  Click Apply.
  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 the Layers 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.
  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 and To as 1 and 60 respectively, and check # Major Levels and input 6 for it. Click OK back to Plot Details dialog. Under the level column of the table, start from the second row, set the level values to be 1,2,4,8,15,30,60 respectively as depicted.
  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.  
  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, and set Layout to be Separated. Select Title from the left, and then check Show checkbox in the right panel and click OK button. You can move and resize the color scale as you desired.
  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.
  9. In the first copied graph, delete the color scale. Right click the layer number symbol at the upper left corner, select Axis… . With Horizontal is selected in the left panel, Under the Scale tab on the right panel, set the From and To values to be -195 and -125 respectively.  Then select Vertical in the left, set From and To to 50 and 75 respectively. Click OK, Alaska is now shown in this graph.
  10. Repeat step 8 for the second graph copy. Set the Horizontal scale as -195 to -120 and Vertical scale as 5 to 30.  hawahii
  11. Click merge button in the right side tool bar,  click the button besides the Graphs selection window to open up the graph browser. Select all three graphs in the left panel and click >> button to move them to the right and then click OK to go back to the Merge Graph Window.  Set the Number of Rows and Number of Columns to 1.  Make sure Link Source Graphs is unchecked. Click OK to close the dialog.colormapformapdata_24
  12. In the generated merged graph, move and resize the layer for Alaska and Hawaii as desired for better display.


One Comment on “Colormap with Specified Values for Map Data Plot”

  1. Very cool! ! ! ! ! ! ! ! ! ! ! I have been looking for this tutorial for a long time and finally learned how to use this app.

Leave a Reply

Your email address will not be published. Required fields are marked *