Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Pylab uses numpy, you can look up the provided data formats <a href="http://docs.scipy.org/doc/numpy/user/basics.types.html" rel="nofollow">here</a>. You use very high numbers in the first column and have no need for float double precision but for hight integer values. Look at the example data you've pasted:</p> <pre><code>&gt;&gt;&gt; x = np.loadtxt('./temp.dat', unpack=True, dtype=('float'), delimiter=',')[0] &gt;&gt;&gt; x array([ 1.00000000e+14, 1.00000000e+14, 1.00000000e+14, 1.00000000e+14, 1.00000001e+14, 1.00000001e+14]) &gt;&gt;&gt; x = np.loadtxt('./temp.dat', unpack=True, dtype=('uint64'), delimiter=',')[0] &gt;&gt;&gt; x array([100000000012640, 100000000105442, 100000000206866, 100000000304930, 100000000583236, 100000000683528], dtype=uint64) &gt;&gt;&gt; y = np.loadtxt('./temp.dat', unpack=True, dtype=('float'), delimiter=',')[1] &gt;&gt;&gt; scatter(x,y) </code></pre> <p>Note that the what you're doing in your line <code>scatter(data[0],data[1])</code> is done just after the <code>loadtxt()</code> statement for the two columns. The first function show your data after reading in as float. Using the data read in as `uint64' will help you with your scatterplot.</p> <p>Good point to start from : <a href="http://matplotlib.org/gallery.html" rel="nofollow">matplotlib gallery</a></p> <p>Edit to answer your comment, more control over reading of the input data:</p> <pre><code># create python lists to store the data x_vals = [] y_vals = [] #open file and read in a list containing all lines as string f = open("./temp.dat","r") lines = f.readlines() #Go through the lines #strip() takes away "\n" characters and such #split(",") creates a list of the string line splitted into (here: 2) substrings for line in lines: x,y = line.strip().split(",") #append values to their lists and apply the right format x_vals.append(np.uint64(x)) y_vals.append(np.float64(y)) scatter(x_vals,y_vals) #or just plot the data as points using: plot(x_vals,y_vals,"o") </code></pre> <p>Your data has a very huge range between min and max values, you will get better results when you divide the set into the small and the large numbers</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload