[change] fix legend locations to prevent them from bouncing on zoom

This commit is contained in:
Marcel Paffrath 2017-08-31 15:41:59 +02:00
parent 8e59845558
commit 9a61a7f27d
5 changed files with 18 additions and 18 deletions

View File

@ -330,7 +330,7 @@ def autopickstation(wfstream, pickparam, verbose=False,
for ax in fig.axes:
ax.vlines(pstart, ax.get_ylim()[0], ax.get_ylim()[1], color='c', linestyles='dashed', label='P start')
ax.vlines(pstop, ax.get_ylim()[0], ax.get_ylim()[1], color='c', linestyles='dashed', label='P stop')
ax.legend()
ax.legend(loc=1)
##############################################################
if aicpick.getpick() is not None:
# check signal length to detect spuriously picked noise peaks
@ -872,7 +872,7 @@ def autopickstation(wfstream, pickparam, verbose=False,
ax1.set_title('%s, %s, P Weight=%d' % (tr_filt.stats.station,
tr_filt.stats.channel,
Pweight))
ax1.legend()
ax1.legend(loc=1)
ax1.set_yticks([])
ax1.set_ylim([-1.5, 1.5])
ax1.set_ylabel('Normalized Counts')
@ -930,7 +930,7 @@ def autopickstation(wfstream, pickparam, verbose=False,
else:
ax2.set_title('%s, S Weight=%d, SNR=None, SNRdB=None' % (
trH1_filt.stats.channel, Sweight))
ax2.legend()
ax2.legend(loc=1)
ax2.set_yticks([])
ax2.set_ylim([-1.5, 1.5])
ax2.set_ylabel('Normalized Counts')
@ -973,7 +973,7 @@ def autopickstation(wfstream, pickparam, verbose=False,
[-1.3, -1.3], 'g', linewidth=2)
ax3.plot([lpickS, lpickS], [-1.1, 1.1], 'g--', label='lpp')
ax3.plot([epickS, epickS], [-1.1, 1.1], 'g--', label='epp')
ax3.legend()
ax3.legend(loc=1)
ax3.set_yticks([])
ax3.set_ylim([-1.5, 1.5])
ax3.set_xlabel('Time [s] after %s' % tr_filt.stats.starttime)

View File

@ -272,7 +272,7 @@ class AICPicker(AutoPicker):
x = self.Data[0].data
ax.plot(self.Tcf, x / max(x), 'k', label='(HOS-/AR-) Data')
ax.plot(self.Tcf, aicsmooth / max(aicsmooth), 'r', label='Smoothed AIC-CF')
ax.legend()
ax.legend(loc=1)
ax.set_xlabel('Time [s] since %s' % self.Data[0].stats.starttime)
ax.set_yticks([])
ax.set_title(self.Data[0].stats.station)
@ -313,7 +313,7 @@ class AICPicker(AutoPicker):
ax1.plot([self.Pick, self.Pick], [-0.1, 0.5], 'b', linewidth=2, label='AIC-Pick')
ax1.set_xlabel('Time [s] since %s' % self.Data[0].stats.starttime)
ax1.set_yticks([])
ax1.legend()
ax1.legend(loc=1)
if self.Pick is not None:
ax2 = fig.add_subplot(2, 1, 2, sharex=ax1)
@ -336,7 +336,7 @@ class AICPicker(AutoPicker):
ax2.set_xlabel('Time [s] since %s' % self.Data[0].stats.starttime)
ax2.set_ylabel('Counts')
ax2.set_yticks([])
ax2.legend()
ax2.legend(loc=1)
if plt_flag == 1:
fig.show()
try: input()
@ -480,7 +480,7 @@ class PragPicker(AutoPicker):
ax.set_xlabel('Time [s] since %s' % self.Data[0].stats.starttime)
ax.set_yticks([])
ax.set_title(self.Data[0].stats.station)
ax.legend()
ax.legend(loc=1)
if plt_flag == 1:
fig.show()
try: input()

View File

@ -150,7 +150,7 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=0, verbosity=1, fig=None):
ax.set_title(
'Earliest-/Latest Possible/Most Likely Pick & Symmetric Pick Error, %s' %
X[0].stats.station)
ax.legend()
ax.legend(loc=1)
if plt_flag == 1:
fig.show()
try: input()
@ -330,7 +330,7 @@ def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=0, fig=None):
ax1.plot(t[islope1], xraw[islope1], label='Slope Window')
ax1.plot(zc1, np.zeros(len(zc1)), '*g', markersize=14, label='Zero Crossings')
ax1.plot(t[islope1], datafit1, '--g', linewidth=2)
ax1.legend()
ax1.legend(loc=1)
ax1.text(Pick + 0.02, max(xraw) / 2, '%s' % FM, fontsize=14)
ax1.set_yticks([])
ax1.set_title('First-Motion Determination, %s, Unfiltered Data' % Xraw[
@ -678,7 +678,7 @@ def wadaticheck(pickdic, dttolerance, iplot=0, fig_dict=None):
ax.plot(checkedPpicks, wdfit2, 'g', label='Wadati 2')
ax.set_title('Wadati-Diagram, %d S-P Times, Vp/Vs(raw)=%5.2f,' \
'Vp/Vs(checked)=%5.2f' % (len(SPtimes), vpvsr, cvpvsr))
ax.legend()
ax.legend(loc=1)
else:
ax.set_title('Wadati-Diagram, %d S-P Times' % len(SPtimes))
@ -789,7 +789,7 @@ def checksignallength(X, pick, TSNR, minsiglength, nfac, minpercent, iplot=0, fi
ax.plot([t[isignal[0]], t[isignal[len(isignal) - 1]]],
[minsiglevel, minsiglevel], 'g', linewidth=2, label='Minimum Signal Level')
ax.plot([pick, pick], [min(rms), max(rms)], 'b', linewidth=2, label='Onset')
ax.legend()
ax.legend(loc=1)
ax.set_xlabel('Time [s] since %s' % X[0].stats.starttime)
ax.set_ylabel('Counts')
ax.set_title('Check for Signal Length, Station %s' % X[0].stats.station)
@ -901,7 +901,7 @@ def checkPonsets(pickdic, dttolerance, jackfactor=5, iplot=0, fig_dict=None):
ax.set_xlabel('Number of P Picks')
ax.set_ylabel('Onset Time [s] from 1.1.1970')
ax.legend()
ax.legend(loc=1)
ax.set_title('Jackknifing and Median Tests on P Onsets')
if plt_flag:
fig.show()
@ -1108,7 +1108,7 @@ def checkZ4S(X, pick, zfac, checkwin, iplot, fig=None):
ax.set_ylabel('Normalized Counts')
ax.axvspan(pick, pick + checkwin, color='c', alpha=0.2,
lw=0)
ax.legend()
ax.legend(loc=1)
ax.set_xlabel('Time [s] since %s' % zdat[0].stats.starttime)
if plt_flag == 1:
fig.show()

View File

@ -272,7 +272,7 @@ class map_projection(QtGui.QWidget):
for index, name in enumerate(self.station_names):
self.annotations.append(self.main_ax.annotate(' %s' % name, xy=(self.x[index], self.y[index]),
fontsize='x-small', color='white', zorder=12))
self.legend = self.main_ax.legend()
self.legend = self.main_ax.legend(loc=1)
def add_cbar(self, label):
cbar = self.main_ax.figure.colorbar(self.sc_picked, fraction=0.025)

View File

@ -1245,7 +1245,7 @@ class PickDlg(QDialog):
self.get_arrivals(True)
ax = self.phaseplot.ax
self.arrivals.plot(ax=ax, show=False)
ax.legend()
ax.legend(loc=1)
self.phaseplot.new = False
self.phaseplot.draw()
self.phaseplot.show()
@ -2553,7 +2553,7 @@ class TuneAutopicker(QWidget):
[y_bot, y_bot], linewidth=2, color='teal')
ax.plot([pick - 0.5, pick + 0.5],
[y_top, y_top], linewidth=2, color='teal')
ax.legend()
ax.legend(loc=1)
def plot_manual_Spick_to_ax(self, ax, pick):
y_top = 0.9 * ax.get_ylim()[1]
@ -2564,7 +2564,7 @@ class TuneAutopicker(QWidget):
[y_bot, y_bot], linewidth=2, color='magenta')
ax.plot([pick - 0.5, pick + 0.5],
[y_top, y_top], linewidth=2, color='magenta')
ax.legend()
ax.legend(loc=1)
def fill_tabs(self, event=None, picked=False):
self.clear_all()