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
- First of all, install the two apps, Import Shapefile 、 Colormap for Map Data, into Origin 2017.
- 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: 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 .shp file.
- 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.
- Within the dialog, select the .shp file unzipped in step 2. Check the Auto checkbox of both File Name (attribute) 、 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
- 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.
- 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.
- 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
- 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.
- Go back to the worksheet with the reordered data. Highlight the Value column (column F) and select Column:Set Column Values…
- 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.
- 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
- Go to the worksheet with the reordered data, change the comments of the column with green lock (column G) to Medals.
- 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 、 To as 20 and 55 respectively. Click Apply.
- Under tabs Tick Labels, Title, Line and Ticks for bottom and left axis, clear Show checkbox. Click OK.
- 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.
- 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 、 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.
- Click the Fill header of the table to bring up the Fill dialog. Check Load Palette and select BlueYellow. Check Flip Palette. Click OK.
- 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.
- 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.
- 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 、 To values to be -195 and -125 respectively. Then select Vertical in the left, set From 、 To to 50 and 75 respectively. Click OK, Alaska is now shown in this graph.
- Repeat step 8 for the second graph copy. Set the Horizontal scale as -195 to -120 and Vertical scale as 5 to 30.
- 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 、 Number of Columns to 1. Make sure Link Source Graphs is unchecked. Click OK to close the dialog.
- In the generated merged graph, move and resize the layer for Alaska and Hawaii as desired for better display.