本文整理汇总了Python中matplotlib.widgets.RadioButtons.disconnect方法的典型用法代码示例。如果您正苦于以下问题:Python RadioButtons.disconnect方法的具体用法?Python RadioButtons.disconnect怎么用?Python RadioButtons.disconnect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.widgets.RadioButtons
的用法示例。
在下文中一共展示了RadioButtons.disconnect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from matplotlib.widgets import RadioButtons [as 别名]
# 或者: from matplotlib.widgets.RadioButtons import disconnect [as 别名]
class PickPhaseMenuMore:
""" Pick phase for multiple seismograms and array stack
Button: Sync
"""
def __init__(self, gsac, opts, axs):
self.gsac = gsac
self.opts = opts
self.axs = axs
self.axstk = self.axs['Fstk']
if not 'stkdh' in gsac.__dict__:
if opts.filemode == 'sac' and os.path.isfile(opts.fstack):
gsac.stkdh = SacDataHdrs(opts.fstack, opts.delta)
else:
hdrini, hdrmed, hdrfin = opts.qcpara.ichdrs
self.cchdrs = [hdrini, hdrmed]
self.twcorr = opts.ccpara.twcorr
# check data coverage
opts.ipick = hdrini
opts.twcorr = opts.ccpara.twcorr
checkCoverage(gsac, opts)
gsac.selist = gsac.saclist
self.ccStack()
self.initPlot()
self.plotStack()
self.addEarthquakeInfo()
self.setLabels()
self.connect()
def initPlot(self):
""" Plot waveforms """
gsac = self.gsac
opts = self.opts
sortSeis(gsac, opts)
self.ppm = PickPhaseMenu(gsac, opts, self.axs)
# make the legend box invisible
if self.opts.pick_on:
self.ppm.axpp.get_legend().set_visible(False)
def addEarthquakeInfo(self):
""" Set Earthquake Info
* Magnitude
* Location (Lat and Long)
* Depth
"""
gsac = self.gsac
# get required parameters
locationLat = round(gsac.event[6],2)
locationLon = round(gsac.event[7],2)
depth = round(gsac.event[8],2)
magnitude = round(gsac.event[9],2)
all_gcarc = []
[all_gcarc.append(hdr.gcarc) for hdr in gsac.selist ]
avg_gcarc = round(np.mean(all_gcarc),2)
infoaxis = self.axs['Info']
# remove axes markings
infoaxis.axes.get_xaxis().set_ticks([])
infoaxis.axes.get_yaxis().set_visible(False)
# write the info into the axis plot
infoaxis.text(0.1,0.85,'Magnitude: '+str(magnitude))
infoaxis.text(0.1,0.65,'Lat: '+str(locationLat))
infoaxis.text(0.1,0.45,'Lon: '+str(locationLon))
infoaxis.text(0.1,0.25,'Depth: '+str(depth))
infoaxis.text(0.1,0.05,'Gcarc: '+str(avg_gcarc))
def setLabels(self):
""" Set plot attributes """
self.ppm.axpp.set_title('Seismograms')
if self.opts.filemode == 'pkl':
axstk = self.axstk
trans = transforms.blended_transform_factory(axstk.transAxes, axstk.transAxes)
axstk.text(1,1.01,self.opts.pklfile,transform=trans, va='bottom', ha='right',color='k')
axpp = self.ppm.axpp
trans = transforms.blended_transform_factory(axpp.transAxes, axpp.transData)
font = FontProperties()
font.set_family('monospace')
axpp.text(1.025, 0, ' '*8+'qual= CCC/SNR/COH', transform=trans, va='center',
color='k', fontproperties=font)
def plotStack(self):
""" Plot array stack and span """
colorwave = self.opts.pppara.colorwave
stkybase = 0
ppstk = PickPhase(self.gsac.stkdh, self.opts, self.axstk, stkybase, colorwave, 1)
ppstk.plotPicks()
ppstk.disconnectPick()
self.ppstk = ppstk
self.axstk.set_title('Array Stack')
self.ppstk.stalabel.set_visible(False)
if self.opts.ynorm == 1.0:
self.axstk.set_ylim(stkybase-0.5, stkybase+0.5)
self.axstk.set_yticks([stkybase])
self.axstk.set_yticklabels([])
self.axstk.axvline(x=0, color='k', ls=':')
# plot legend
#.........这里部分代码省略.........