CS 251: Assignment #4

Integration and Display

Due 13 March 2012

The goal of this lab is to bring together all of the elements--data, GUI, and viewing--into a single application that enables interactive visualization of data sets in the proper format.


The result of this project should be an application that can read in a data set, enable the user to interactively view it in up to 5 user-selected dimensions (3 spatial, color, and size).

  1. Give yourself a new working directory and copy your display, viewing, and data python files into it. It's best to start with copies and modify them from there. Integration often involves re-writing parts of your code to make the process cleaner. From the last project, you should be able to read one or more CSV data files in the proper format and manage them in a listbox on the GUI.
  2. Enable the user to select between 2 and 5 columns for plotting. It's up to you how you design the GUI to handle this. You can require the user to select three spatial dimensions before allowing them to use color or size. Alternatively, you can be flexible and let the user pick 2 or 3 spatial dimensions and then either color or size as additional dimensions.

    One possible approach to handling this is to have a menu option 'Plot' that brings up a dialog which gives the user a set of popup menus for selecting each axis/color/size. You could also place popup menus or list boxes on the right side of the main screen with a button "plot" that uses the current menu selections to generate a plot.

    Here is a reasonable dialog window tututorial

    To implement plotting, create a buildPoints function and an updatePoints function in your display class that are analagous to your buildAxes and updateAxes functions. The buildPoints should delete any existing canvas objects representing data and create a new set for the current plot.

    You probably want to follow the steps below in your buildPoints method, which may take in a list of the selected headers. Either before calling it or within buildPoints you will want to reset the view.

    • Delete any existing canvas objects used for plotting data.
    • Get the spatial columns to plot from the user selections, possibly in the form of DataColID objects. If you are selecting only 2 columns to plot, add a column of 0's (z-value) and a column of 1's (homogeneous coordinate) to the data. If you are selecting 3 columns to plot, add a column of 1's (homogeneous coordinate). Each data point is now represented as a 4-column row in the spatial data matrix.
    • At this point you have to make a decision about how to normalize the data. A simple approach is to use the max and min value of each data column to normalize it to the range [0, 1].

      x' = float(x - xmin) / float(xmax - xmin)

    • Get the data columnes corresponding to the color and size dimensions, if any. You may want to store these in separate fields. You may also want to normalize both of these data columns so the values are in the range [0, 1].
    • Calculate the VTM from the current view object.
    • Transform the data using the VTM.

      pts = (vtm * data.T).T

    • Create the canvas graphics objects, ovals/squares/crosses/points, for each data point. Use the color and size data, if any, to adjust the visual attributes. Letting the user specify the type of graphics object to use in the plot is a nice extension.

    The updatePoints method should modify the coordinates of the existing canvas objects using the current view. You should include a call to updatePoints wherever you have a call to updateAxes.

    Make sure your program can read in test data case 1 and display 2 or 3 spatial dimensions. Then try test data case 2, which has 5 dimensions, the first two of which are correlated. Capture some screen shots for your writeup.

  3. Test your system on the Australia Coast data. Try plotting using latitude and longitude as (x, y) with other dimensions as z, color, and size. Capture some screen shots. An extension is to enable the user to select an Eckert projection for the latitude and longitude variables.



Write a brief user manual, with screen shots, for your application. Include any extensions or enhancements you implemented.

Include the screen shots for the provided data sets and for your own.


Once you have written up your assignment, give the page the label:


Put your code in the private subdirectory of your folder on Courses. Please make sure you are organizing your code by project.