Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 isn't worth posting, because it's that line that's giving me the problem. When I change "scatter" to "plot" it graphs the data, but each point is part of a line and that makes the whole things a scribbly mess. I just want points, not a line, 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
like image 325
user212562 Avatar asked Nov 17 '09 02:11

user212562


People also ask

Why are scatter plots not connected?

Scatter plots are similar to line graphs in that they start with mapping quantitative data points. The difference is that with a scatter plot, the decision is made that the individual points should not be connected directly together with a line but, instead express a trend.

What are the common issues with scatter plot?

Two common issues have been identified with the use of scatter plots – overplotting and the interpretation of causation as correlation. Overplotting occurs when there are too many data points to plot, which results in the overlapping of different data points.


1 Answers

I bet engineSize, fuelMile are stings, try printing them, if that is the case, you have to convert them to float before passing them as arguments to scatter

floatval = float(strval)
like image 116
guest Avatar answered Sep 21 '22 01:09

guest