Class 9 – Start Arrays

Overview

Today we are going to look further into arrays.  The link (pdf=TwoDArrays-2024).

Video

Homework

Due Wednesday February 21, 2024:

  1. Your are only allowed to add two lines of code to answer this question.  Take your code from today where you read in Brian.csv and plotted the array.  You can only add two more lines of code to your work from today to make the plot.   Using two lines of code and your slicing nomenclature add an exclamation point.  Remember in the file I had the background as 0’s and the writing as 1’s.  You need to at least make a third color!.  Then print it in a color of your choice using a colormap.  My answer is below. Both answers are perfectly correct.  I just wanted to add more color this year!  To make the lines crisp I turned off interpolation.  Here is the documentation. But in imshow you need to add the keyword argument interpolation=’none’ like we did in class.                brian

2.  For part 2.  Make a new csv file in excel and make it so you can print your name in more than one color.   So read in your file and make the plot.  By plot it I mean show your name like I show my name!   As a hint.  I made my csv file in excel and I made the rows and columns smaller or changed the zoom so I could see the pattern I was entering.  When saving a csv in excel using the ms-dos csv option seems to work the best.  When making the csv file name the csv file with your name.

3.  For the third part.  Make an excel file with one column for x-values and three columns for y-values.  Label each column. I would do ten or so rows.  So approximately ten values for the x-values.  For the y-columns make each distinct.  You can choose your own function or pattern (straight, curved, etc)  for the y-values.   But make sure each line is unique.  Now read in the file and plot the lines in excel and label the axes.   So you need to make an excel file and use it to plot three distinct lines.

For handing in make sure to hand in your notebook, your csv file for you name, and the excel file for your lines.