2d density plot using Python
<p>I had been trying to make a 2D density plot from a data file using the code below in Python</p>

<h1>2d.py</h1>

<pre><code>import matplotlib.pyplot as plt
import matplotlib.cm as cm
from matplotlib.colors import LogNorm
import numpy as np

fig1 = plt.figure(1)

x, y, z1, z2 = np.loadtxt('fort.101',unpack=True)
N = int(len(z1)**.5)
z1 = z1.reshape(N, N)
plt.imshow(z1, extent=(np.amin(x), np.amax(x), np.amax(y), np.amin(y)),
           cmap=cm.hot)
plt.colorbar()
fig1.savefig('2d.eps')
</code></pre>

<p>The figure that it creates is 90 degrees rotated from what is created by GNUPlot. That is to say, the two figures are 90 degrees out of phase. Can anyone help me resolve this issue?</p>

<p><a href="http://i.stack.imgur.com/sD1Pe.png" rel="nofollow">enter image description here</a></p>

<p><a href="http://i.stack.imgur.com/Uri8R.png" rel="nofollow">enter image description here</a></p>

<p>This is what I am getting...</p>

python plot 2d