def PlotVollmer(self, event): #initialize the plot areas self.dataFigure.clf() axes = Subplot(self.dataFigure, 111, clip_on='True',xlim=(-0.1,1.05), ylim=(-0.1,1.05),autoscale_on='True',label='vollmer',aspect='equal', adjustable='box',anchor='SW') self.dataFigure.add_subplot(axes) axes.axis["right"].set_visible(False) axes.axis["top"].set_visible(False) axes.axis["bottom"].set_visible(False) axes.axis["left"].set_visible(False) try: sqrt3_2 = 0.866025 #m_sqrt(3)/2 tr1 = Line2D((0,1),(0,0),c='black') axes.add_line(tr1) tr2 = Line2D((0,0.5),(0,sqrt3_2),c='black') axes.add_line(tr2) tr3 = Line2D((1,0.5),(0,sqrt3_2),c='black') axes.add_line(tr3) for i in [0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9]: diag = Line2D((i/2,1.0-i/2),(sqrt3_2*i,sqrt3_2*i),c='grey',lw=0.5) axes.add_line(diag) diag2 = Line2D((i/2,i),(sqrt3_2*i,0),c='grey',lw=0.5) axes.add_line(diag2) diag3 = Line2D((i,i+(1-i)/2),(0,sqrt3_2-sqrt3_2*i),c='grey',lw=0.5) axes.add_line(diag3) axes.text(-0.08,-0.05,'Point',family='sans-serif',size=self.fontSize,horizontalalignment='left' ) axes.text(0.97,-0.05,'Girdle',family='sans-serif',size=self.fontSize,horizontalalignment='left' ) axes.text(0.5,0.88,'Random',family='sans-serif',size=self.fontSize,horizontalalignment='center' ) # label axes values for i in [0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9]: axes.text((1-i)/2, sqrt3_2*(1-i)-0.01, '%d' % (i*100), family='sans-serif', size=self.fontSize, horizontalalignment='right', color='grey', rotation='60') axes.text(i, -0.02,'%d' % (i*100), family='sans-serif', size=self.fontSize, horizontalalignment='center', verticalalignment='top', color='grey') axes.text(1.0-i/2, sqrt3_2*i-0.01,'%d' % (i*100) , family='sans-serif', size=self.fontSize, horizontalalignment='left', color='grey', rotation='-60') # ternary plot (from wikipedia) # P = (0,0) # G = (1,0) # R = (1/2, sqrt(3)/2) # given (P,G,R): # x = G + R/2 # y = (sqrt(3)/2) * R if len(self.idxPlan) == 0 and len(self.idxLin) == 0: # in case we have only one one opened file but it is not checked raise AttributeError else: for i in range(len(self.idxPlan)): x = self.PeigenList[i]["G"] + (self.PeigenList[i]["R"] / 2) y = self.PeigenList[i]["R"] * sqrt3_2 axes.plot(x,y, self.PProps[i]["PoleSymb"], c=self.PProps[i]["PolColor"], ms=self.PProps[i]["polespin"],label='%s n=%d' % (self.Pname[i],self.Pndata[i])) for j in range(len(self.idxLin)): x = self.LeigenList[j]["G"] + (self.LeigenList[j]["R"] / 2) y = self.LeigenList[j]["R"] * sqrt3_2 axes.plot(x,y, self.LProps[j]["LineSymb"], c=self.LProps[j]["LinColor"], ms=self.LProps[j]["linespin"],label='%s n=%d' % (self.Lname[j],self.Lndata[j])) axes.legend(bbox_to_anchor=(0.97, 0.8), loc=2, prop=FontProperties(size=self.fontSize),numpoints=1) axes.set_xlim(-0.1,1.05) axes.set_ylim(-0.1,1.05) self.dataCanvas.draw() except AttributeError: self.dataFigure.clf() dlg = wx.MessageDialog(None, _('No file(s) selected (checked).\n\n'), _('Oooops!'), wx.OK|wx.ICON_ERROR) dlg.ShowModal() dlg.Destroy() pass
def PlotFlinn(self, event): #initialize the plot areas self.dataFigure.clf() axes = Subplot(self.dataFigure, 111, clip_on='True',xlim=(-0.2,7.2), ylim=(-0.2,7.2),autoscale_on='True',xlabel='ln(S2/S3)',ylabel='ln(S1/S2)',label='flinn',aspect='equal', adjustable='box',anchor='W') self.dataFigure.add_subplot(axes) axes.axis["right"].set_visible(False) axes.axis["top"].set_visible(False) try: # plot lines of K for i in [0.2, 0.5, 1.0, 2.0, 5.0]: if i <= 1.0: diag = Line2D((0,7.0),(0,(i*7.0)),c='grey',lw=0.5) axes.add_line(diag) else: diag = Line2D((0,(7.0/i)),(0,7.0),c='grey',lw=0.5) axes.add_line(diag) # plot lines of C for j in [2,4,6]: diag2 = Line2D((0,j),(j,0),c='grey',lw=0.5) axes.add_line(diag2) # texts axes.text(6.25,0.05,'K = 0',family='sans-serif',size=self.fontSize,horizontalalignment='left',color='grey') axes.text(0.15,6.1,'K = inf.',family='sans-serif',size=self.fontSize,horizontalalignment='left',color='grey',rotation='vertical') axes.text(6.45,6.4,'K = 1',family='sans-serif',size=self.fontSize,horizontalalignment='center',color='grey',rotation='45') axes.text(3.2,6.4,'K = 2',family='sans-serif',size=self.fontSize,horizontalalignment='center',color='grey',rotation='63.5') axes.text(1.2,6.4,'K = 5',family='sans-serif',size=self.fontSize,horizontalalignment='center',color='grey',rotation='78.7') axes.text(6.4,3.1,'K = 0.5',family='sans-serif',size=self.fontSize,horizontalalignment='center',color='grey',rotation='26.6') axes.text(6.5,1.3,'K = 0.2',family='sans-serif',size=self.fontSize,horizontalalignment='center',color='grey',rotation='11.3') axes.text(2.6,3.35,'C = 6',family='sans-serif',size=self.fontSize,horizontalalignment='center',color='grey',rotation='-45') axes.text(1.75,2.2,'C = 4',family='sans-serif',size=self.fontSize,horizontalalignment='center',color='grey',rotation='-45') axes.text(3.5,3.75,'Girdle/Cluster Transition',family='sans-serif',size=self.fontSize,horizontalalignment='left',verticalalignment='bottom',color='grey',rotation='45') axes.text(6.5,7.2,'CLUSTERS',family='sans-serif',size=self.fontSize,horizontalalignment='right',verticalalignment='bottom',color='grey') axes.text(7.2,6.5,'GIRDLES',family='sans-serif',size=self.fontSize,horizontalalignment='left',verticalalignment='top',color='grey',rotation='-90') # plot the selected (checked) files # propsPList = [pdata, itemName, PolColor, symbPoles, polespin,... # propsLList = [pdata, itemName, LinColor, LineSymb, linespin,... if len(self.idxPlan) == 0 and len(self.idxLin) == 0: # in case we have only one one opened file but it is not checked raise AttributeError else: for i in range(len(self.idxPlan)): axes.plot(self.PeigenList[i]["K_x"],self.PeigenList[i]["K_y"], self.PProps[i]["PoleSymb"], c=self.PProps[i]["PolColor"], ms=self.PProps[i]["polespin"], label='%s n=%d' % (self.Pname[i],self.Pndata[i])) for j in range(len(self.idxLin)): axes.plot(self.LeigenList[j]["K_x"],self.LeigenList[j]["K_y"], self.LProps[j]["LineSymb"], c=self.LProps[j]["LinColor"], ms=self.LProps[j]["linespin"], label='%s n=%d' % (self.Lname[j],self.Lndata[j])) axes.legend(bbox_to_anchor=(1.1, 1), loc=2, prop=FontProperties(size='small'),numpoints=1) #set the axes limits and draws the stuff axes.set_xlim(0.0,7.2) axes.set_ylim(0.0,7.2) self.dataCanvas.draw() except AttributeError: self.dataFigure.clf() dlg = wx.MessageDialog(None, 'No file(s) selected (checked).\n\n', 'Oooops!', wx.OK|wx.ICON_ERROR) dlg.ShowModal() dlg.Destroy() pass