title: strings, lists and matplotlib
body: <p>I am trying to read some data from a file and then take the first row and plot it on a graph against some other data using matplotlib. </p>
  
  <p>My code is</p>
  
  <pre><code>import numpy as np    
  import matplotlib.pyplot as plt
  
  with open("file path",'r') as f:
      s=  f.readlines()
  
      y=(s[0])
  
  x=np.arange(0.00,9.04,0.04)
  
  plt.plot(x,y)
  
  plt.ylabel('Probability Distribution')
  
  plt.xlabel('Photometric Redshift')
  plt.title('r2')                 
  plt.show()
  </code></pre>
  
  <p>I get the following error message</p>
  
  <pre><code>Traceback (most recent call last):
    File "dsl_2_python.py", line 36, in &lt;module&gt;
      plt.plot(x,y)
    File "/usr/lib64/python2.7/site-packages/matplotlib/pyplot.py", line 2817, in plot
      ret = ax.plot(*args, **kwargs)
    File "/usr/lib64/python2.7/site-packages/matplotlib/axes.py", line 3996, in plot
      for line in self._get_lines(*args, **kwargs):
    File "/usr/lib64/python2.7/site-packages/matplotlib/axes.py", line 330, in _grab_next_args
      for seg in self._plot_args(remaining, kwargs):
    File "/usr/lib64/python2.7/site-packages/matplotlib/axes.py", line 289, in _plot_args
      linestyle, marker, color = _process_plot_format(tup[-1])
    File "/usr/lib64/python2.7/site-packages/matplotlib/axes.py", line 126, in _process_plot_format
  
      'Unrecognized character %c in format string' % c)
  
  ValueError: Unrecognized character 0 in format string
  </code></pre>
  
  <p>></p>
  
  <p>I think it is something to do with <code>y</code> being a string not a list, but <code>s</code> seems to be a list, so I don't know why <code>y</code> becomes a string or how to make it a list.  Can anyone help?</p>