The main purpose of this project was to put together the core elements of the last three projects, i.e. GUI, Data, and Viewing Class API, into a single application that can read in a data set, displays it in 2D or 3D, and let user interactively view the data in 5 dimesions (3 spatial axes - x, y, z, color, and size). There were three primary tasks to create such application: 1) read in a data set and display the data points according to user's interaction with GUI, i.e. panning, scaling, and rotating, 2) create a dialog window that enables the user to select which data to display in which axes and dimensions (color & size) and obtains the user's selections, and 3) reflect the color and size aspects of data through data points. Displaying the data points in x, y, and z dimensions was similar as building and updating the axes in the last project. I completed task 2 by creating 5 labels and list boxes, which have a full list of data in each box, in the dialog window. Lastly, I modified the color and size of a data point when drawing it on canvas according to the user's selected data for color and size. After completing these tasks, my application now has all the described features and more. I will describe my extensions later.
Instructions for User (follow these steps in order):
Following instructions describe the workflow for a user to open data, select columns, and generate the plot.
- First the user will need to read in a data set before plotting it. To do so, the user can simply press Control-o and select the file. If the user clicks 'Plot Data' button in the right control frame before reading in a file, below error message (Figure 1) will pop up.
- After reading in a data set, the user will notice then the second list box in the right control frame now has the name of the loaded data set. Figure 2 shows an example when the user reads in 'AustrailiaCoast.csv' file.
- In order to plot the loaded data set, the user then must make a selection from the second list box. If not, the user will see following error message (Figure 3).
- After the user reads in a data set, makes a selection from the second list box, and click the 'Plot Data' button, following dialog window (Figure 4) will now pop up.
- A lot of things can now happen depending on the user's selection of axes and dimensions. With my extension (more detail in the extensions section), the user is able to plot a histogram by selecting 1 column. However, the selected one column must be made in X-axis. In general, selection in X-axis must be made; otherwise, following error message (Figure 5) appears.
If X-axis is selected and the user makes selections from other dimensions with the exception of y-axis, following error message (Figure 6) will show up.
There are essentially four possible selections of axes and dimensions: 1) histogram with X-axis selected, 2) 2D-plot with X & Y-axes selected, 3) 3D-plot with X & Y & Z-axes selected, and 4) 2D & 3D-plot with additional dimensions such as color and size.
After making an appropriate combination of selections from the list boxes, the user can then plot the loaded data set by clicking 'ok' button of the dialog window. If the user clicks 'cancel' button, following error (Figure 7) message appears.
- See the required images for examples of generated plots.
Required Image 1: plot of the AustrailiaCost data using longitude (x-axis), latitude (y-axis), premax (z-axis).
(Requried Image 1)
Required Image 2: plot of the AustrailiaCost data using logitude (x-axis), latitude (y-axis), runoffnew (z-axis), maxairtemp (color), premax (size)
(Required Image 2)
Required Image 3: plot of mydata.csv using government spending (x-axis), corporate investment (y-axis), real GDP (z-axis), interest-rate (color), unemployment (size)
(Required Image 3)
Handle resizing the window appropriately, which means possibly changing the screen and extent parameters of your view..:For this extension, I created the handleResize() method in display class, which calculates how much the width and height of the window have changed and updates the screen parameters of the view object. The method then updates the axes and data points.
Extend the range of plotting options to 1-5 columns, where selecting 1 column generates a histogram.
: Using 'matplotlib' module and its sub-modules neccesary for embedding plots in tkinter GUI, I was able to generate a histogram based on the user's selection of X-axis. Note that my application, at the moment, does not let the user decide the number of bins for histogram. The codes to generate and display histogram are in handlePlotData() method because I need to know whether the user selected the X-axis only. Figure 8 is the histogram of AustrailiaCost data's longitude.
Implement visualization dimensions other than color and size such as texture or shape.: Note that the first list box in the right control frame contains three different shapes for data points: circle, square, and triangle. The user simply needs to select the shape to display data points in that shape. I made the list box as a field of display class, obtained the user's selection in buildPoints() method, and modified the drawing of data points accordinly. Below are the images (Figure 9) of same data set with different shapes.(Figure 9)
Let the user select or mouse-over a data point and then pop up a window or display the point's raw values in a status bar.: This extension was trickier than my initial thought because I did not store the data object and its raw values together. To access the raw value of a given data point, which I stored in self.objects, I also stored the headers from handleChooseAxes in a field, self.raw_headers. I then called get_value() method of self.data_object with the header and the looping variable as parameters. I implemented this extension in the reportValue() method, which was binded to the mouse motion. I will show an image of this extension altogether with the last extension.
Handle the case where the user wants to have multiple files open.: To enable the user to have multiple files open, I did not create the data object given a filename in handleOpen() method. I rather added the loaded filename to the second listbox, which is self.data_lb. I then create the data object based on the user's selection from the second list box in handlePlotData. The concept of this extension was straightforward; the challenge was to make sure there is no loophole in creating a data object without having the user reading in a data set or choosing the filename from the list box. Because of the size of the list-box, the user can have maximum of 3-files open. If the user wants to read in additional files after opening three, the user can delete one of the entries in the listbox by selecting the entry and clicking the 'Delete' button. The 'Delete' button will remove the selected entry from the listbox and remove the plot if it is already drawn.
Put labels on the axes that stick with them as they rotate/scale/translate: I added X, Y, Z labels that are attached to the corresponding to the axes. They stick with the axes as they rotate/scale/translate. I built and updated theses labels where I built and updated the axes.
Make use of your analysis functions and let the user view data properties like the mean, standard deviaion, and range of selected columns.: Once I create a data object and store the headers in handlePlotData() method, I used analysis class's mean, stdev, and data_range() methods to report the data properties of the selected headers. To report the values dynamically, I created and made text-variables as fields and updated them in handlePlotData(). Note that the data properties and raw value of a data point are reported at the bottom frame of the window. Figure 10 shows the image of reporting the data properties and raw value.
Demo: (demonstrating running display.py)
From this project, I learned how to integrate a basic GUI with a data API that can read in a data set and operate data-analysis and View class API that implements the user-interaction with GUI.
For this project, I received help from professor Maxwell and Taylor and Prashant.