Why won't my python scatter plot work?

I created a very simple scatter plot using pylab.

pylab.scatter(engineSize, fuelMile)
pylab.show()

The rest of the program is not worth publishing, because this is the line that gives me the problem. When I change the "spread" to the "graph", it graphically displays the data, but each point is part of the line, and this makes things whole literally messy. I just need dots, not a string, but I get this huge error message that ends with:

  File "C:\Python26\lib\site-packages\numpy\core\fromnumeric.py", line 1643, in amin
    return amin(axis, out)
TypeError: cannot perform reduce with flexible type
+5
source share
2 answers

engineSize, fuelMile - , , , float, .

floatval = float(strval)
+9

, , - . , , "" :

>>> import pylab
>>> pylab.scatter([500, 550, 700, 1100], [5.5, 6.5, 3.1, 9.7])
<matplotlib.collections.RegularPolyCollection object at 0x036F5610>
>>> pylab.show()
(graphing-type stuff ensues)
+2

All Articles