Note that there are some explanatory texts on larger screens.

plurals
  1. POChanging the origin of a plot
    text
    copied!<p>I have a table of data with 3 columns, which I want to plot the third column in terms of the first two in a colorful 2D plot. For example for the following table i.e.</p> <pre><code>4.0 4.0 0.313660827978 4.0 5.0 0.365348418405 4.0 6.0 0.423733120134 5.0 4.0 0.365348418405 5.0 5.0 0.439599930621 5.0 6.0 0.525083754405 6.0 4.0 0.423733120134 6.0 5.0 0.525083754405 6.0 6.0 0.651536351379 </code></pre> <p>I use the following code:</p> <pre><code>x,y,z = np.loadtxt('output_overlap.dat').T #Transposed for easier unpacking nrows, ncols = final_step_j-1, final_step_k-1 grid = z.reshape((nrows, ncols)) plt.imshow(grid, extent=(x.min(), x.max(), y.max(), y.min()), interpolation='nearest', cmap='binary') fig1 = plt.gcf() plt.colorbar() plt.xlabel('m1') plt.ylabel('m2') plt.draw() fig1.savefig('test.pdf', dpi=100) close('all') </code></pre> <p>which gives me the following plot: <a href="https://dl.dropboxusercontent.com/u/31460244/test.png" rel="nofollow">https://dl.dropboxusercontent.com/u/31460244/test.png</a></p> <p>Which is correct. Now, my question is: how can I change the order of showing data in the Y axis? I would like to have the point (4,4) at the origin. </p> <p>I have tried changing </p> <pre><code>plt.imshow(grid, extent=(x.min(), x.max(), y.max(), y.min()) </code></pre> <p>to:</p> <pre><code>plt.imshow(grid, extent=(x.min(), x.max(), y.min(), y.max()) </code></pre> <p>It does change the numbers in the grid but not the actual data. This is not the solution. Anybody can give me a help here?</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