Lab: Build a Scatter Plot

Assigned: Monday, Feb 20, 2017

Due: Monday, Feb 27, 2017 at noon

Collaboration: You should work with your assigned partner for this lab.

In this lab, you will use your developing D3 expertise to build a scatter plot from a CSV dataset. This time we will use a subset of R’s txhousing dataset, which includes monthly home sales numbers from cities in Texas; this dataset includes many cities, but I have selected a subset of the four most largest cities in Texas by population: Houston, San Antonio, Dallas, and Austin. Unlike the previous lab, I won’t tell you exactly what to plot; I am interested in how home prices and sales interact in different cities, but you will have to decide what variables to plot. Hint: you might want to make it easy to change which value you plot on your scatter plot so you can explore the dataset graphically.

Groups

  • Larry, JaeEun, and Sam
  • Logan and Jinlin
  • Peiyun and Uzo
  • Kevin and Alex
  • Maddy and Reilly
  • Bazil and Nick R.
  • Ritika and Ben
  • Jemuel and Tommy
  • Dennis and Trang
  • An and Linh
  • Ruth and Ying
  • Minh and Zachary
  • Connor and Nick K.
  • Kathy and Bao

Getting Started

As usual, start this lab by forking the starter code on GitHub at grinnell-cs/datavis-scatter-plot. Make sure you add your partner as a collaborator on the repository so you can both push changes.

The lab starter code includes the basic HTML template, an empty CSS file, and few lines to load the dataset from the CSV file. As with the last lab, you will need to run a local web server to test this file if you use Chrome as your web browser; apparently Firefox works just fine without running a server.

The requirements for this lab are fairly open-ended, but a complete lab should help me to answer at least one of the following questions:

  1. What happens to home prices in each city when the number of listings goes up or down?
  2. Do lower prices coincide with increased or decreased numbers of homes sold?
  3. Does the sale price of homes depend on the total inventory? Inventory is the number of houses listed divided by the current sales rate in months.

Hint: You may not see many clear trends if you plot all the points together. If you separate points by city, using either color or facets, you might notice some more interesting trends.

In addition to helping me to answer one of the questions above, your lab must include:

  1. A plot title
  2. A legend
  3. Labeled X and Y axes (both titles and values)

We will spend time in class to discuss scales and axes, but you may want to look at the D3 Documentation on Continuous Scales. This takes care of some of the hassle in dealing with the SVG inverted coordinate system.

Extra Credit: Multiple plots on one page

If you complete the basics of your scatter plot in the available time, you can earn some extra credit by adding multiple scatter plots on one page. This could help you to give a better sense of the dataset than you could fit into a single plot. You should implement your plots using shared code rather than copy-pasting code for each scatterplot.