cosmetics for array plots (title, legend)

This commit is contained in:
Marcel Paffrath 2015-10-22 10:54:24 +02:00
parent 0223869df6
commit 30680a7820

View File

@ -16,13 +16,14 @@ class SeisArray(object):
Note: Source and Receiver files for FMTOMO will be generated by the Survey object (because traveltimes will be added directly).
'''
def __init__(self, recfile):
self.recfile = recfile
self._receiverlines = {}
self._receiverCoords = {}
self._measuredReceivers = {}
self._measuredTopo = {}
self._sourceLocs = {}
self._geophoneNumbers = {}
self._receiverlist = open(recfile, 'r').readlines()
self._receiverlist = open(self.recfile, 'r').readlines()
self._generateReceiverlines()
self._setReceiverCoords()
self._setGeophoneNumbers()
@ -472,28 +473,33 @@ class SeisArray(object):
def plotArray2D(self, plot_topo = False, highlight_measured = False, annotations = True):
import matplotlib.pyplot as plt
plt.interactive(True)
plt.figure()
fig = plt.figure()
ax = plt.axes()
xmt, ymt, zmt = self.getMeasuredTopoLists()
xsc, ysc, zsc = self.getSourceLocsLists()
xmr, ymr, zmr = self.getMeasuredReceiverLists()
xrc, yrc, zrc = self.getReceiverLists()
plt.plot(xrc, yrc, 'k.', markersize = 10, label = 'all receivers')
plt.plot(xsc, ysc, 'b*', markersize = 10, label = 'shot locations')
if len(xrc) > 0:
ax.plot(xrc, yrc, 'k.', markersize = 10, label = 'all receivers')
if len(xsc) > 0:
ax.plot(xsc, ysc, 'b*', markersize = 10, label = 'shot locations')
if plot_topo == True:
plt.plot(xmt, ymt, 'b', markersize = 10, label = 'measured topo points')
ax.plot(xmt, ymt, 'b', markersize = 10, label = 'measured topo points')
if highlight_measured == True:
plt.plot(xmr, ymr, 'ro', label = 'measured receivers')
ax.plot(xmr, ymr, 'ro', label = 'measured receivers')
plt.xlabel('X [m]')
plt.ylabel('Y [m]')
plt.title('2D plot of seismic array %s'%self.recfile)
ax.set_xlabel('X [m]')
ax.set_ylabel('Y [m]')
ax.set_aspect('equal')
plt.legend()
if annotations == True:
for traceID in self.getReceiverCoordinates().keys():
plt.annotate((' ' + str(traceID)), xy = (self._getXreceiver(traceID), self._getYreceiver(traceID)), fontsize = 'x-small', color = 'k')
ax.annotate((' ' + str(traceID)), xy = (self._getXreceiver(traceID), self._getYreceiver(traceID)), fontsize = 'x-small', color = 'k')
for shotnumber in self.getSourceLocations().keys():
plt.annotate((' ' + str(shotnumber)), xy = (self._getXshot(shotnumber), self._getYshot(shotnumber)), fontsize = 'x-small', color = 'b')
ax.annotate((' ' + str(shotnumber)), xy = (self._getXshot(shotnumber), self._getYshot(shotnumber)), fontsize = 'x-small', color = 'b')
@ -508,11 +514,18 @@ class SeisArray(object):
xmt, ymt, zmt = self.getMeasuredTopoLists()
xmr, ymr, zmr = self.getMeasuredReceiverLists()
xin, yin, zin = self.getReceiverLists()
xrc, yrc, zrc = self.getReceiverLists()
xsc, ysc, zsc = self.getSourceLocsLists()
ax.plot(xmt, ymt, zmt, 'b*', markersize = 10, label = 'measured topo points')
ax.plot(xin, yin, zin, 'k.', markersize = 10, label = 'interpolated receivers')
ax.plot(xmr, ymr, zmr, 'ro', label = 'measured receivers')
plt.title('3D plot of seismic array %s'%self.recfile)
if len(xmt) > 0:
ax.plot(xmt, ymt, zmt, 'b.', markersize = 10, label = 'measured topo points')
if len(xrc) > 0:
ax.plot(xrc, yrc, zrc, 'k.', markersize = 10, label = 'all receivers')
if len(xmr) > 0:
ax.plot(xmr, ymr, zmr, 'ro', label = 'measured receivers')
if len(xsc) > 0:
ax.plot(xsc, ysc, zsc, 'b*', label = 'shot locations')
ax.set_xlabel('X'); ax.set_ylabel('Y'); ax.set_zlabel('elevation')
ax.legend()