Data Visualization

11月 222010
In my previous blog post, I talked about using a Web Map Service (WMS) to generate a background map. The WMS feature is more flexible than the static background maps provided as part of JMP. But it requires the user to find an appropriate WMS server and then determine specific information about the server, such as layer names.

This can be a time-consuming task in itself. Searching the Web will help you find WMS servers that are publicly available. But it can be more difficult to figure out what the layer names are and what the resultant map will look like. To help with this discovery process, I have taken advantage of another JMP 9 feature called the add-in. An add-in is a way to extend the functionality of JMP. Add-ins (including this one) can be downloaded from the add-ins page on the JMP File Exchange.

I created an add-in called the WMS Explorer. The WMS Explorer add-in is designed to make it easier for you to find a WMS server, query the server for layer names and show you what a map will look like. Here is what the WMS Explorer add-in looks like.

WMS Explorer add-in

At the top of the window is a text field where you can type in a URL to a WMS server. You can find possible WMS servers by searching the Web. After you enter a URL, either hit the enter key or click on the Get Layers button. This will send a query to the WMS server and return a list of layers that the server supports. If you do not know the URL for a server, you can select one from the drop-down list, directly below the text field. Selecting a URL from the list will populate the text field and submit the query for layer names.

The graph, below the drop-down list, will now contain a boundary map. Initially, the graph will show the Earth, with each country outlined. To the left of the graph is a list of layer names that the server supports. Select a layer name, and another request will be made to the server. This request will return a map that will be set as the background map on the graph. Here is an example where I selected the first URL in the drop-down list, the NASA server, and chose BMNG as the layer name.

Example using NASA server and BMNG as layer name

You can select the different layer names to see what each map will look like.

The graph is a typical graph in JMP, which means that all the regular JMP controls are available to you. You can adjust the axes or use the zoom tool (found on the hidden menu bar) just as you would in JMP. You can also right-mouse-button (RMB) to select Size/Scale->Size to Isometric to get your graph back into a proper aspect ratio. RMB will also allow you to select Background Map, where you can adjust the boundary map. Here is an example where I entered a URL for a WMS server in Spain and zoomed in on the Strait of Gibraltar. In this map, Spain is to the north and Morocco is to the south.

Example using WMS server in Spain, creating map zoomed in on Strait of Gibralter

Occasionally, a request to a WMS server will result in an error. At the bottom of the add-in window, there is an area for any error messages. You may try a server that no longer exists or is temporarily down. Or you may select a layer name that the server no longer supports. In a case like this, instead of returning a map, the server may return an error message that will be displayed in this area. Any error message that is displayed is a message that came directly from the WMS server.

Once you find a map that you want to use, simply note the URL in the text field and the name of the selected layer. This is the information you will need to use the WMS background map feature in JMP.

I hope you enjoy the WMS Explorer add-in and find it useful. If you find a good WMS server, please send it to me. I’ll try to keep an up-to-date list available to share with other JMP users. As always, feel free to share your comments and suggestions.
11月 192010
I started to work at JMP this past summer as a student intern. One of my first projects was to create a background map for the office temperatures study. As you probably know, JMP 9 can graph map shapes using built-in map files. JMP can also work from user-created shapes, which can be imported from ERSI SHP files or created from scratch. To make the latter process easier, I created the visual Custom Map Creator add-in.

Shapes in JMP are defined by two different data tables that work together, a name file and an XY file. The name file contains the ID and name of the shape that you are defining. The XY file contains four different columns that define the shape coordinates. The first column is the ID of the shape that is defined in the name file. There is also a part ID, which is used if you have multiple parts to a single shape. For example, if you were defining Hawaii, each island would be a part, and all of the islands would have the same shape ID. Finally, the X and Y columns specify the location of one particular point in the boundary.

In the image below, shape 50 has six rows that correspond to the six points. Since the shape is not broken into multiple pieces, it has one part.

a shape that has 6 rows and 6 points

The process of creating the shapes by hand is tedious at best, but the Custom Shape Creator add-in allows you to create the different shape boundaries with the click of a button. All you have to do is drag the image that you want to model into the Custom Map Creator window and use your mouse to define each boundary.

The image shown below is the start of my recreation of the offices map. The Custom Map Creator has a few different visualization options to help you make your boundaries. The line width and color can be changed, in addition to being able to fill the shapes in with a random color (as enabled in the picture below).

I recreated the office map in about 25 minutes with this add-in. No more manually entering in coordinates! As an added bonus, the magnifying glass still works so your map can be really detailed.

The Custom Map Creator is available on the JMP File Exchange. If you have any awesome maps that you created and would like to share I’d love to see them in the comments.
11月 102010
Previously, I wrote about the image-based background maps that are provided as part of the JMP install. These maps work well when you are viewing a larger area of the world, such as a country or even a state or province.

But if you want to zoom in closer, these maps start to degrade. The resolution of the Simple Earth and Detailed Earth maps are not high enough to zoom in on a city, for example. To get that level of detail, we need to use another source -- the Internet. JMP 9 has two options on the background map dialog for Internet sources. Those options are NASA server and Web Map Service.

The NASA server provides maps for the entire Earth. Here is a graph of the Earth, which we’ve seen before, but this time it is using the NASA server as its source for the background map. It also has a boundary map turned on, to show the outlines of the countries.

Not only does this server cover the entire Earth, but you can also zoom in on a much smaller area of the Earth and still get a reasonable map. Here is a map showing the Colorado River running through the Grand Canyon, in Arizona. The Grand Canyon Village is visible in the bottom of the map.

If you look at the axes values, you can see that we are zoomed in such that we are viewing an area that is less than 1/10° by 1/10°. The Simple Earth and Detailed Earth background maps cannot display that kind of resolution. The NASA server can give us a fairly detailed view of any land mass on Earth. Water, however, is simply filled in as black. The NASA server is free to access, but it is also limited in availability. If the server is temporarily unavailable or becomes overloaded with requests, it will deliver an error message instead of the requested map.

Another Internet-based option for background maps is a Web Map Service (WMS). The WMS option allows you to specify any server that supports the WMS interface. The NASA server is an example of a WMS server, but we have provided the URL and a layer name for you. With the WMS option, you must know the URL to the WMS server and a layer name supported by the server. Most WMS servers support multiple layers. For example, one layer may show terrain, another layer may show roads, and still another layer may include water, such as rivers and lakes. By specifying the URL for the server and the layer, JMP can make a request to the server and then display the map that is returned.

Here is a popular map around my office. I used a WMS server that provides maps for Wake County, North Carolina. The server URL is and the layer is named 16:0. This map plots the location of Starbucks coffee shops around SAS headquarters in Cary, NC. Blue indicates a free-standing Starbucks. Red indicates it is inside another establishment, such as a grocery store or gas station.

There are 20 Starbucks shops within a three-mile radius of my office. It is no wonder that Cary is consistently rated as one of the top cities to live in, in the United States. Perhaps I should use JMP to analyze the traffic patterns between each Starbucks and the office each weekday morning -- and then see how that relates to productivity!

If you want to use the WMS option for a background map, the question then becomes: Which WMS server can I use? There are many WMS servers freely available across the Internet. Most of them provide maps only for a particular area of the world, and each of them supports their own layers. So each user will likely have to search out the appropriate WMS server for his or her particular situation. A good starting point is Google (or whatever your favorite search engine is). Also, here are some links that I have found useful for finding a WMS server:

Once you find a WMS server, you still have to figure out what layers it supports. This can be a little tricky. But never fear -- I wrote a JMP add-in to help you with that. But that is a topic for my next blog post.

Until then, see if you can find a good WMS server for your particular needs. And, as always, feel free to let me know what you think.

All About Background Maps in JMP 9: Simple Earth and Detailed Earth

 Background Maps, Business Visualization, Data Visualization, JMP 9, Tips and Tricks  All About Background Maps in JMP 9: Simple Earth and Detailed Earth已关闭评论
11月 012010
In my previous blog post, I gave an overview of the different types of background maps you can add to a graph in JMP 9. Today, I will discuss two of the options for a background map: Simple Earth and Detailed Earth.

Simple Earth and Detailed Earth are two of the choices under Images on the background map dialog. They both consist of a collection of raster images that can be tiled together to make a map of the entire Earth. Both sets of imagery are bundled with JMP and are installed as part of the JMP installation process. This means that no Internet connection is necessary to use a background map -- nor will you have to find and install an extra download.

Here is a graph that uses Simple Earth as the background map.

graph that uses Simple Earth as the background map

To create the tiles for Simple Earth, my source data was Natural Earth III, from The Natural Earth III data is public domain and free to use, modify and disseminate. The Natural Earth III texture maps come in different versions from the deluxe edition, which includes clouds and arctic ice, down to a basic version. I opted for a version in the middle, which included better geography but did not include either the clouds or arctic ice. It uses a green and brown color scheme for the land and a constant deep blue for water.

The image that I started with had a resolution of 16,200 x 8,100 pixels. I first increased the compression of the jpeg image, which minimally reduced the visual quality while reducing the overall size of the image (and the resultant tiles) considerably. I then wrote a script that would read in the complete image and tile it into many smaller pieces. I generated three different sets of images.

For the first set of images, each image covers an area that is 10° by 10° at a resolution of 450 x 450 pixels. The images in the second set cover an area of 30° by 30° and are at a resolution of 360 x 360 pixels. Each image in the final set covers an area of 45° by 45°, at a resolution of 540 x 540 pixels. If you calculate the pixel-to-degree ratio for each set, you’ll see that the resolution decreases with each set. The reason for the multiple sets is so that a higher resolution is used when you are zoomed in, showing the highest-quality possible. When you are zoomed out, using a lower resolution reduces the number pixels that have to be processed at render time, allowing the graph to render more quickly.

Here is an example of Detailed Earth used as the background map. This graph might look familiar as it is the same data I showed in my previous blog post. Because I used the Detailed Earth background, we now see more detail in the water. Simple Earth doesn't show any detail in water features.

example of Detailed Earth used as the background map

The source for the Detailed Earth was Natural Earth data. This data also comes in different versions and resolutions. Since I wanted this background map to be more detailed, I started with the raster version of the highest resolution I could get, which was the large scale data, 1:10m. From the different options, I chose Natural Earth 1, with Shaded Relief, Water and Drainage. This version had a softer color scheme than Simple Earth, lighter greens and browns for the land, as well as variation in the blue for the water.

Detailed Earth is so named because it has slightly more detail than Simple Earth, in terms of resolution as well as in the geography and the water features. I created the Detailed Earth tiles in a similar way to the Simple Earth tiles. Like the Simple Earth data, I generated three sets of tiles, using the same coverage sizes and resolutions, with one exception. The highest resolution set has a resolution of 600 x 600 pixels for each tile. I was able to get the higher resolution for the first set, since the original source had a resolution of 21,600 x 10,800 pixels. Because of this, you can zoom into a graph further with Detailed Earth than with Simple Earth, before the quality of the background image begins to blur.

You can use transparency with both Simple Earth and Detailed Earth. Tip: To set the transparency, right-mouse-button over the graph and select the Customize... menu option. This will bring up the Customize dialog, where you can select the Background Map and assign a value for transparency. A valid value for transparency goes from 0.0 (completely transparent) to 1.0 (completely opaque).

In the graph below, you can see wind data plotted over a background map showing Lake Michigan. Originally, the arrows were difficult to see over the dark green of the map. After applying 50% transparency, the background map fades out, and the data becomes more visible.

wind data plotted over a background map showing Lake Michigan

Another nice feature of Simple Earth and Detailed Earth is the ability to wrap. The Earth is round, and when you cross 180° longitude, the Earth doesn't end. The longitudinal value continues from -180° and increases. The map will wrap continuously in the horizontal direction, much as the Earth does. The background map does not wrap in the vertical direction.

Simple Earth and Detailed Earth both support a geodesic scaling (thanks to Xan Gregg). In the images above, the Earth appears as a rectangle, where the width is twice as wide as the height. If we were to take this rectangle and roll it up, we would have a cylinder. This is known as a Mercator projection, named after the geographer and cartographer, Gerardus Mercator.

In reality, we know that the Earth doesn’t form a cylinder, but rather a sphere (or at least a close approximation to a sphere). So while the Mercator projection is useful for laying out the Earth with straight longitudinal and latitudinal lines, it distorts the actual size and shape of areas of the Earth. This distortion increases as we move from the equator toward the poles. To get rid of this distortion, you can use a geodesic scaling, which transforms the map to a more realistic representation of the Earth. To use the geodesic scaling, simply change the type of scale on the axes.

Tip: You can change the axes scale by selecting the right-mouse-button over the axis and then selecting Axis Settings…. Change the Scale to Geodesic or Geodesic US. Both choices will transform the map to a geodesic scaling. Use Geodesic US if you are viewing a map of the continental US and you want Alaska and Hawaii to be included in the map. It is important to note that you must set the scale to geodesic for both axes to get the transformation. You will not see a change in the map after setting only one of the axes.

In this graph, we see Simple Earth used as the background map with the axes set to use a geodesic scale. The axes lines are turned on as well. Notice the longitudinal lines are now curved, instead of straight. You might also notice how Greenland looks here compared to how it looked in the previous maps. (Greenland is the country at a high latitude in the Atlantic Ocean, predominantly covered in ice.)

Simple Earth used as the background map with the axes set to use a geodesic scale

Simple Earth and Detailed Earth are very easy to use, involving nothing more than selecting the option in the background map dialog. You don't need an Internet connection. The axes define the appropriate tiles for the background map.

But both Simple Earth and Detailed Earth do have their limitations. Tune in next time when you’ll hear somebody say, “Hey, when I zoom in to see my neighborhood, those Earth background maps get pretty fuzzy. What’s up with that?”

Got JMP 8? You Can Map, Too

 Background Maps, Data Visualization, JMP 8, JMP 9, Tips and Tricks  Got JMP 8? You Can Map, Too已关闭评论
10月 282010
By now, you are probably aware that JMP 9 delivers some cool new mapping features. I definitely encourage you to experience them firsthand. However, if you still use JMP 8, or have a colleague who has not upgraded to JMP 9 yet, a new script on the file exchange might be just what you need.

The Polygon Script Creator (download requires a login) allows you to choose one or more US states and generate a graphics script that you can add to any JMP graph. The graphics script lets you include a map background in your JMP graphs. The creator dialog has a resolution level choice of Low, Medium or High. Note that while High resolution will have the most detail, it can also take a long time to generate, especially if you have selected a lot (or all) of the states. For small numbers of states, High resolution should not take too long.

After you have generated the map that you want, there is a Create Script button that brings up the graphics script in a Script Editor window. This is the script that you can copy and paste into a JMP graphics customization window. (To get to a JMP graphics customization window, right-click on a JMP graph and select "Customize.” In the customization window, simply click the "plus" button to add a new graphics script and paste the generated script into the script box in the customization window.)

Here is an example of adding a map graphics script to a JMP graph, produced in JMP 8.0.2:
example of bubble plot with map of North Carolina
10月 262010
JMP 9 users: Now that you have invested in the most recent version of the interactive visual statistical discovery software package, I know you will want to make the most of your investment. You can do this by taking training. And now, you can train at your own pace and in the comfort of your home or office!

I am excited to announce the first multimedia e-Course in the JMP curriculum – JMP Software: Data Exploration.

screenshot of JMP e-Course showing how to use JMP scripts to recreate reports

This course has content equivalent to our classroom training, and the lessons include demos, practices and quizzes. Whether you are a new JMP customer or you are upgrading to JMP 9, this e-Course will help you learn the essentials of JMP. It is eight hours' worth of material, and you get a yearlong license to access it 24/7.

Become familiar with the new JMP 9 graphical and analytical capabilities through this self-paced format. Take the course chapter by chapter, or skip to the lessons where you need help. If you would like to learn more about our e-Courses, check out the e-Courses page.

If you have JMP 9 and are interested in this new interactive e-Course, be the FIRST to submit a comment on this post describing in 50 words why you would benefit from this JMP e-Learning course, and I will give you free access! Be sure to enter your e-mail address when you write your comment.
10月 212010
If you saw the JMP 9 launch webcast on Oct. 12 or have seen the JMP website lately, you know geographic visualization is a prominent feature of JMP 9. You likely saw a map being drawn underneath the data, and you may have wondered, "How did they do that?" The answer is background maps.

background map of the world

Background maps are a new feature in JMP 9. There are different types of background maps. Some maps are built into JMP, delivered as part of the JMP install. Other maps are retrieved from an Internet source, and still other maps are user-defined. From a user’s perspective, adding a background map may require nothing more than flipping a switch. That switch will generate a great-looking map, giving your data a geographic context and giving you a whole new way to view your data.

Since background maps are new, let’s take a quick look at the overall functionality. The best way to do this might be to look at the Background Map dialog, which is available from the graph right-click menu next to Background Color.

Background Map dialog

The Background Map dialog shows two columns of choices. The column on the left is called Images. The column on the right is called Boundaries.

The boundary-style maps are vector-based shapes. This type of map draws an outline around a defined area. Some of these are provided as part of JMP, or a user can define his or her own. Because of this, the list you see may be different than the one presented here. This type of background map has been mentioned in other blog posts, such as What Factors Affect Office Temperature? Creating Custom Maps.

The image maps are raster images. These are more like the type of map you see when you open an atlas or use a GPS. There are two types of image-based background maps. Simple Earth and Detailed Earth are tiles of images that live locally on your computer. They were installed as part of JMP. The NASA server and Web Map Service options are Internet-based mapping options. By the way, you can turn on both an image map and a boundary map at the same time.

When you turn on a background map for a graph, the axes are used to display the appropriate portion of a map. The Earth is defined as -180° to 180° in the horizontal direction (longitude), going from left to right. It is defined as 90° to -90° in the vertical direction (latitude), going from top to bottom. The limits of the axes will be used to define the limits of the map that get displayed.

Let’s experiment with the background map options. To do so, simply open a JMP data table that has geographical-based data. You can find some of these in the Samples Data directory that is installed with JMP. Run JMP and open the sample data file called Run the script called Bubble Plot (not the script called Bubble Plot with Map, as that would be jumping ahead). When you run this script, you get a graph that looks like this:

This graph shows the location of a hurricane, Claudette, on July 15th, 1979. The first thing you might see is that even though the location of the hurricane is plotted, it doesn’t really tell us where it is. We need a little more context. We could look at the axes, but I would bet that not too many people would know exactly where 10° North latitude, 50° West longitude would put us on the Earth. Being incredibly brilliant and logical, you might realize that because it is a hurricane, it is likely to be over the Atlantic Ocean. Of course, you would be correct, a true testament to your intellect. But we still don’t know where it is, really. Is it out over the middle of the Atlantic, or is it over a small island? This could make a big difference, especially for the inhabitants of the small island. Obviously, a map in the background of our graph would add a good deal of information. So let’s right-mouse-click over the graph, and we’ll get a context-sensitive menu.

Select Background Map… and you will be presented with the Background Map dialog, which we discussed earlier. You can now select what type of background map you would like to see. Experiment with the different options and see what you get. Use the Go button to see an animation of the hurricane data, moving over the background map. Adjust the axes or use the zoom tool to change what part of the world you are viewing. You will see the map adjust as the view does. Tip: You can always right-mouse-click over the graph and select Size/Scale->Size to Isometric to get the aspect ratio of your graph to be proportional again.

Here is what you will get if you select Simple Earth as the background map:

Watch for future blog posts, where I will discuss the different types of maps in greater detail. But for now, I hope you’ll take this chance to explore them for yourself. If you do, please let me know what you think. Your suggestions might even make it into my future work.

Analyzing NC State Fair Attendance Using JMP

 Data Visualization, Exploratory Data Analysis, JMP - General, JMP 9  Analyzing NC State Fair Attendance Using JMP已关闭评论
10月 202010
Photo of Krispy Kreme burger from NC State Fair Deep Fried blog
The North Carolina State Fair is in full swing in Raleigh this week. All the talk lately in the break room at the office concerns the Fair. "Did you go to the fair this weekend?" "What day will you go?" "Are you going to try a Krispy Kreme burger?" Fried Snickers bars and chocolate-covered bacon are sooo last year -- this year's outrageous food item is the hamburger with doughnuts where the buns should be (see photo at right, used with permission from Paul Jones of the NC State Fair Deep Fried blog).

If you're a planner, you might want to attend the fair on a day when the crowds aren't as large. That way parking should be more tolerable, and you won't have to wait as long in the Krispy Kreme burger line.

Conveniently, attendance numbers are available on the NC State Fair website. Last week, a SAS colleague analyzed this data using SAS. That motivated me to see what JMP can do with it today, which is World Statistics Day.

The website contains a table of data for each day of the fair. To get the data into JMP, first I tried copying and pasting; unfortunately, the data was not formatting properly. Luckily, someone told me about a handy feature in JMP to solve this issue -- Internet Open (under the File menu). Just enter the Web address where the data resides, and JMP automatically finds it, imports it and even formats it correctly.

Note: There are two tables found on the NC State Fair website. Choose the first table to see the attendance data.

Once the table is imported into JMP, there are two housekeeping details necessary to get the data in workable form. Change "Thu." to be a numeric column, and exclude/hide the row for 2010 if it contains partial data.

The first plot I'm interested in seeing will compare trends in attendance over the various years. The Parallel Plot platform can do this with just a few clicks (be sure to select Scale Uniformly). Below I've colored the rows according to which decade they belong to. For example, in the most recent decade (red lines), you can see a sharp spike in attendance on the second Thursday over previous decades. Can anyone tell me when they started the canned food drive on Thursdays?

A colleague suggested that the raw numbers are hard to compare from year to year since the overall numbers vary so much. He would prefer to know the daily attendance for each day as a percentage within each year. To create this plot, we first need to use Transpose in order to turn Day into a column. After adding a new column for the percent, Graph Builder is easily able to produce a graph of box plots that summarizes attendance by percentages per day.

The results are not surprising -- weekends have the heaviest traffic, with the second Saturday being the most popular day to go. I personally like to go on a weeknight. But no matter when I go, no matter what, you won't catch me anywhere near a Krispy Kreme burger!