title: How to plot a graph that creates vertical lines with labels that change based on input parameters
body: <p>I am witting a program that plots spectral data and i need to know the given Redshift, what i am attempting to do is place vertical lines where the elements should be with labels to know which one it is on the graph. however i am unable to find an effective way to plot these lines but also their corresponding labels. I am using two lists, one for the xvals and the other for the labels from items in a csv file.</p>
  <p>some of the issues i am having is not knowing how to effectively pass through values from a csv file to a tuple and then use that tuple list to plot x values and then display its corresponding label. this has to be flexible enough to change.</p>
  <pre><code>emission_line_list_string=[]
  emission_line_elements=[]
  emission_line_list=[] 
  absorption_line_list_string=[]
  absorption_line_elements=[]
  absorption_line_list=[]
  redshifted_em_lines=[]
  redshifted_ab_lines=[]
  em_list=[]
  ab_list=[]
  #=====================================================================
  # default functions:
  
  def emmission_lines(z_obs):
      redshift_formula=(1+z_obs)
      for i in emission_line_list:
          redshifted_em_lines.append(i)
      
  def absorption_lines(z_obs):
      redshift_formula=(1+z_obs)
      for i in absorption_line_list:
          redshifted_ab_lines.append(i)
  def merge_lists(list1,list2,merged_list):
      merged_list=tuple(zip(list1,list2))
      return merged_list
  
  def graph_template(string):
  fig=plt.figure(figsize=(20, 60), dpi=80)
  wavelength1, flux1= np.loadtxt(string,unpack=True)
  ax = plt.subplot(10,1,1)
  ax.set_xticks(np.arange(6000,11000,200))
  plt.xlim(5000,11000)
  ax.set_yticklabels([])
  plt.ylabel('Flux (10$^{-15}$ ergs cm$^{-2}$ s$^{-1}$ A$^{-1}$)',fontsize=15)
  plt.xlabel('wavelength ($\AA$)',fontsize=15)
  ax.xaxis.set_tick_params(which='major',size=7,width=2,direction='in',top='on')
  ax.yaxis.set_tick_params(which='major',size=7,width=2,direction='in',right='on')
  Smoothing = savgol_filter(flux1, 17, 4)
  plt.plot(wavelength1, Smoothing)
  </code></pre>
  <p>this whole mess is my attempt at reading values from a csv file put those values in a list so i can use them to alter them based on redshift and plot them as well as storing the names</p>
  <pre><code>with open('emissionlines.csv',mode='r') as f:
  reader=csv.DictReader(f,delimiter=',')
  for n, row in enumerate(reader):
      emission_line_list_string.append(row['wavelength'])
      emission_line_elements.append(row['element'])
  f.close()
  with open('absorptionlines.csv',mode='r') as f:
      reader=csv.DictReader(f,delimiter=',')
      for n, row in enumerate(reader):
          absorption_line_list_string.append(row['wavelength'])
          absorption_line_elements.append(row['element'])
      f.close()
  for i in emission_line_list_string:
      emission_line_list.append(float(i))
  for i in absorption_line_list_string:
      absorption_line_list.append(float(i))
  merge_lists(emission_line_list,emission_line_elements,em_list)
  merge_lists(absorption_line_list,absorption_line_elements,em_list)
  </code></pre>
  <p>here is where i call upon all the functions</p>
  <pre><code>plt.title(&quot;Slit17, redshift=[]&quot;, fontsize=15)
  z_obs = 1.2
  emmission_lines(z)
  absorption_lines(z)
  graph_template('slit17.dat')
  </code></pre>