I have data with 3 columns separated by commas in a file 'data.txt'
x,y,z
12,12,5.2
12,26,12.1
12,40,3.5
Where x and y are the (x,y) coordinates (range 12-2000) and z is the value/intensity at that point. What is the best way to graph this data?
My initial thought was plotting as a 3-D contour plot and view it down the Z-axis, but even that is giving me some issues. I've made due plotting this as an array and plotting using imshow, but I know there's a better way. What advice do you have?
Attached is a my output using imshow. It works, but it's limited, as soon I will need to change my axes.
This my current code, but I know something needs to change
fig = plt.figure(2)
cmap2 = colors.LinearSegmentedColormap.from_list('my_colormap',['red','yellow','green'],256)
img2 = plt.imshow(data1,interpolation='nearest',cmap = cmap2, norm=MidpointNormalize(midpoint=p50)
,extent=[0.0009,3621085,0.0009,3621085], origin='lower')
cbar=plt.colorbar(img2,cmap=cmap2)
ax = plt.subplot(111)
ax.set_yscale('log')
ax.set_xscale('log')
xposition = [1,3.9,62.5,2000,64000,256000]
for xc in xposition:
plt.axvline(x=xc, color='k', linestyle=':')
plt.axhline(y=xc, color='k', linestyle=':')
img2 = plt.imshow(data1,interpolation='nearest',cmap = cmap2, norm=MidpointNormalize(midpoint=p50)
,extent=[12,2000,12,2000], origin='lower')
plt.colorbar(img2,cmap=cmap2)
fig.savefig(filenameI)
plt.close()
The current way I was plotting my data means the values for x and y are independent of how I graph it. I could make those axes say absolutely anything. In contrast, I would like to graph these data and have them rely on the x- and y-values in my data table, because I will have to change my units at some point. How do I do that?