Build a parameter dictionary I: Figure

A solution to the exercise from the last section

There are lots of ways to go about this. Here's one.

When I present solutions to the exercises, I'll show the diff - the change between the before and after state of the code - to make it clear what I added or changed each time. The tool I use for this at the command line is vimdiff, but there are lots of great tools for this. Also, the naming convention I use is as the solution to exercise 1, as the solution to exercise 27, etc.

We still have a few more preparatory steps before we can start drawing, but hang in there. The thinking and coding we do right now get translated into the power to easily tweak our image into exactly the form we want.

Exercise 2: Build a parameter dictionary, part I: The Figure

  • Create a construct_parameters() function to build a dictionary of parameters for the visualization.
  • Add just the figure height and width.
  • Print the parameter dictionary to the console.

Feel free to use my solution to the last exercise as a starting point:

Ready? Go for it.