CS 70

Homework 2: Plot Student Data

In this step, you will find a data set that you’re interested in, and then plot or visualize your data in a patch in any way that you like.

Implementation Steps

Plotting Your Data

Write a function called plotStudentData(). It should be modeled after plotExampleData, so we recommend debugging that function before you start this one.

You have a large degree of freedom in completing this part. The only constraints we're imposing are

  • Your data set should have at least 50 values.
  • Your data set should be saved in a plain-text file called student_data.txt, and committed to your repository. If you choose to use one of the provided data sets, just make a copy of it in your embroidery/ directory called student_data.txt.
  • Your resulting visualization should fit in a patch that is no more than 50 × 50 units.
  • You should have a satin-stitched edge around your patch. You can do a square or a rectangle, but you might also consider another shape (e.g., a circle).
  • You should plot or in some other way visualize your data. You can do a line plot like we did for the previous part, but you might also consider an alternative way of visualizing the numbers in your own data set.

Beyond that, you are free to add any additional stitches you want. Can you make your plotted data part of a more elaborate picture for your patch?

Your visualization should generate a file called student_data.dst, which you will convert (with convert) to an image file called student_data.svg for viewing.

Helpful Hints

Use Our Data, Or Choose Your Own!

We’ve provided some data sets in the /home/student/data/hw2/ directory. If you’d like to use one of those, be sure to do something new or creative for your visualization!

If you want to find your own data set, some places to look include datahub, the World Bank, climate.gov, or NOAA. You shouldn’t feel limited to those, however—we’re excited to see what data you find and share!

  • Horse speaking

    What were those tips that were on the previous page? I think they still apply!

Don't Forget to Recompile (and Reconvert!)

Remember that every time you change embroidery.cpp, you need to recompile it, relink it, run ./homework2 again and regenerate the .svg file with convert before you can see the results. (If you fix a bug in the code and the output image doesn’t change, you probably forgot one of these steps.)

Pay Attention to Warnings (from clang++ and cpplint)

We recommend that you fix compiler warnings immediately, rather than waiting until the end. Even if most warnings are about issues that don’t cause trouble in practice, sometimes warnings reflect very serious errors in your code!

Similarly, cpplint is pretty picky about how you write your code, so your life will be better if you occasionally run it and correct the formatting as you go, rather than waiting until the end to fix dozens (or for larger programs, hundreds) of small annoying errors.

Visual Studio Code Is Sometimes Clueless

When working on C++ code, sometimes your editor, like VS Code, will try to “help” you. For this assignment, it may complain to you that it does not find turtle-related libraries on your system. This is OK, since VS Code does not really know what is inside of our special CS70 Docker image. When you compile inside of Docker, it will definitely be able to find them.

To Complete This Part of the Assignment

You'll know you're done with this part of the assignment when you've done all of the following:

(When logged in, completion status appears here.)