title: Python: how to fix matplotlib plotting error?
body: <p>I want to make a loop to create a plot for each corresponding column in 2 different csv files such that column 1 in csv A and column 1 in csv B are plotted together with the same timestamp (pulled from another csv). I do not think I will have trouble when I modify my code to create the loop, but I have to get matplotlib to work for the first column before trying to construct a loop.</p>
  
  <p>I have already tried checking to make sure that the correct data is being passed into the function and that is in the correct order. For example, I printed the zipped array as a list (t_array, b_array) and checked my csv files to verify that the data was in the correct order. I have also tried modifying the axes, ticks, and zoom to no avail. I have tried checking the helper functions which I lifted from my other projects and they all work as expected.</p>
  
  <pre><code>def double_plot():
  before = read_file(r_before)
  after = read_file(r_after)
  time = read_file(timestamp)
  if len(before) == len(after):
      b_array = np.asarray(before[1])
      a_array = np.asarray(after[1])
      t_array = np.asarray(time[1])
      plt.plot(t_array, b_array)
      plt.plot(t_array, a_array)
      plt.show()
  else:
      print(len(before))
      print(len(after))
      print("dimension failure")
  </code></pre>
  
  <p>read_file() is a helper function that reads csv files and saves the columns to dictionaries with the first column key indexed by key 
  "1" and so on down the columns. I know I should probably change it to index with 0 first, but this is a problem for later...</p>
  
  <p>Images showing what I want the code to do  and what it is doing</p>
  
  <p><a href="https://i.stack.imgur.com/f2lZ7.png" rel="nofollow noreferrer">What I would like</a>
  <a href="https://i.stack.imgur.com/zmX58.png" rel="nofollow noreferrer">What my code is actually doing</a></p>
  
  <p>Thank you for your time. This is my first time posting so I apologize if something I did was incorrect. I did attempt to find the answer before posting.</p>
  
  <p>Edits: data sample; read_file()</p>
  
  <p><a href="https://i.stack.imgur.com/MUdoC.png" rel="nofollow noreferrer">screenshot of excel</a></p>
  
  <pre><code>def read_file(read_file):
  data = {}
  with open(read_file, 'r') as f:
      reader = csv.reader(f)
      for row in reader:
          col_num = 0
          for col in row:
              col_num += 1
              if col_num in data:
                  data[col_num].append(col)
              else:
                  ls = col
                  ls = [ls]
                  data[col_num] = ls
  return data
  </code></pre>
  
  <p>edit again: ^ its much better to use pandas but I am leaving this here because its funny after seeing it done with dataframes</p>