I have just started using python and tried writing my small program for making simple 2d plots. I am trying to plot 2D matrix (60x60). It all works fine except for the extra element at (x=28,y=60) included in my plot.
I had quite some trouble figuring out what might have gone wrong. Unfortunately due to my modest knowledge of python I didn't really find any meaningful explanation.
The code I am using is
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
from subprocess import call
from math import pi
import sys
x = []
y = []
z = []
if len(sys.argv) > 1:
fname = sys.argv[1]
else:
fname = 'data.txt'
print 'reading data from {}'.format(fname)
print 'This is the correct verssion trimming the blanks'
for l in open(fname, 'r'):
try:
xx, yy, zz = map(float, l.split())
if zz > 0. :
x.append(int(xx))
y.append(int(yy))
z.append(zz)
except ValueError:
pass
plt.scatter(x, y, c=z ,s=35, marker='s',cmap=mpl.cm.spectral,linewidths=0)
plt.clim(0,max(z))
cbar=plt.colorbar()
cbar.ax.set_visible(False)
s=18
plt.xlim([min(x)-3,max(x)+3])
plt.ylim([min(y)-3,max(y)+3])
plt.axis('off')
finalname = fname + '.png'
pdfname = fname + '.png'
plt.savefig(pdfname,dpi=100,bbox_inches='tight')
I used it to plot f(x,y)=x*y/(x+y). The plot I got is:

Note that I have an unwanted extra element in my plot indicated by the pointer. I manipulated my data to produce the cut in the upper right part of the plot. The x,y,z values I used can be found here:
Perhaps what I am doing is not the best solution. Therefore, I would appreciate any better alternative solutions.
Thank you in advance Alex