title: How do I plot a matrix as a distance vs. time plot using matplotlib?
body: <p>I am trying to plot the values (0's and 1's) that are stored in a 501x120 matrix. The plot is displaying but my x and y ticks correspond to the matrix indexes. I want to set these ticks to the corresponding distances (x-axis) and time (y-axis). I.e., the 501 rows correspond to a time series from 0 to 2 seconds with samples every 0.004 seconds. The columns are distances that go from (-600m to 600m) with a distance between columns of 10 m.</p>
  <p>This is what I have written down so far:</p>
  <pre><code>  # Import libraries. The magic command '%matplotlib inline' shows figures as an output in the same jupyter notebook.
      %matplotlib inline
      import matplotlib.pyplot as plt
      import numpy as np
      
      v1 = 1500 #first layer velocity in m/s
      h1 = 200  #vertical distance to first reflector in m
      dt = 0.004 #sample rate in s
      channels = 120 #number of geophones
      dx = 10 #distance between geophones in m
      dhalf = channels/2*dx #divide total distance in two. This is because we will assume a source at the center of the array, i.e., a central-shot gather
      offsets = np.arange(channels)*dx-dhalf #creates numpy array with offsets to all 120 geophones
      
      td = [np.sqrt(x**2+ 4*h1**2) for x in offsets] #calculates reflection travel distances to each geophone
      tt = np.array(td)/v1 #calculates travel times as derived above
      
      num_samples = 501 # number of samples per trace
      seismic_data = np.zeros((num_samples,channels)) #creates a zero-matrix with a row per sample and a column per trace/channel. 
      for channel in range(channels): 
          sample=int(tt[channel]/dt)
          seismic_data [sample,channel]=1
          type(seismic_data)
              
      # This loop looks in each channel for the sample number closest to the one that corresponds to the reflected wave arrival and turns the 0 into a 1 (spike).
      fig,ax = plt.subplots(figsize=(10,20))
      ax.imshow(seismic_data)
      ax.set_aspect(.3)
  </code></pre>