matplotlib.pyplot errorbar ValueError depends on array length?
<p>Good afternoon.</p>

<p>I've been struggling with this for a while now, and although I can find similiar problems online, nothing I found could really help me resolve it. </p>

<p>Starting with a standard data file (.csv or .txt, I tried both) containing three columns (x, y and the error of y), I want to read in the data and generate a line plot including error bars.</p>

<p>I can plot the x and y values without a problem, but if I want to add errorbars using the matplotlib.pyplot errorbar utility, I get the following error message:</p>

<p><code>ValueError: yerr must be a scalar, the same dimensions as y, or 2xN.</code></p>

<p>The code below works if I use some arbitrary arrays (numpy  or plain python), but not for data read from the file. I've tried converting the tuples which I obtain from my input code to numpy arrays using asarray, but to no avail. </p>

<pre><code>import numpy as np
import matplotlib.pyplot as plt

row = []
with open("data.csv") as data:
    for line in data:
        row.append(line.split(','))

column = zip(*row)

x = column[0] 
y = column[1]
yer = column[2]

plt.figure() 
plt.errorbar(x,y,yerr = yer)

fig = plt.gcf()
fig.set_size_inches(18.5, 10.5)
fig.savefig('example.png', dpi=300)
</code></pre>

<p>It must be that I am overlooking something. I would be very grateful for any thoughts on the matter.</p>