Changeset 3967 for trunk/Absorb.py


Ignore:
Timestamp:
May 11, 2019 10:12:27 AM (3 years ago)
Author:
vondreele
Message:

embed fprime & absorb plots in GSAS-II plot window as separate tabs. This removes conflict between contour plots & fprime/absorb plots

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Absorb.py

    r3963 r3967  
    99import wx
    1010import numpy as np
    11 import matplotlib as mpl
    12 import matplotlib.pyplot as plt
    1311import sys
    1412import GSASIIpath
     
    321319    def __init__(self, parent):
    322320        self._init_ctrls(parent)
    323         mpl.rcParams['axes.grid'] = True
    324         mpl.rcParams['legend.fontsize'] = 10
     321        self.parent = parent
    325322        self.Lines = []
    326323        self.linePicked = None
    327324
    328325    def OnExitMenu(self, event):
    329         plt.close('all')
     326        self.parent.G2plotNB.Delete('Absorb')
    330327        self.Close()
    331328        self.Destroy()
     
    577574        xylim = []
    578575        try:
    579             self.fplot.canvas.set_window_title('X-Ray Absorption')
    580576            if rePlot:
    581                 asb = self.fplot.get_children()[1]
     577                asb = self.Page.get_children()[1]
    582578                xylim = asb.get_xlim(),asb.get_ylim()
    583579            newPlot = False
    584580        except:
    585             self.fplot = plt.figure(facecolor='white',figsize=(8,6))  #BTW: default figsize is (8,6)
    586             self.fplot.canvas.set_window_title('X-Ray Absorption')
    587             self.fplot.canvas.mpl_connect('pick_event', self.OnPick)
    588             self.fplot.canvas.mpl_connect('button_release_event', self.OnRelease)
    589             self.fplot.canvas.mpl_connect('motion_notify_event', self.OnMotion)
     581            new,plotNum,self.Page,self.fplot,lim = self.parent.G2plotNB.FindPlotTab('Absorb','mpl')
     582            self.Page.canvas.mpl_connect('pick_event', self.OnPick)
     583            self.Page.canvas.mpl_connect('button_release_event', self.OnRelease)
     584            self.Page.canvas.mpl_connect('motion_notify_event', self.OnMotion)
    590585            newPlot = True
    591         ax = self.fplot.add_subplot(111)
     586        ax = self.Page.figure.add_subplot(111)
    592587        ax.clear()
    593588        ax.set_title('X-Ray Absorption',x=0,ha='left')
     
    616611        if newPlot:
    617612            newPlot = False
    618             plt.show()
     613            self.Page.canvas.draw()
    619614        else:
    620615            if rePlot:
    621                 tb = self.fplot.canvas.toolbar
     616                tb = self.Page.canvas.toolbar
    622617                tb.push_current()
    623618                ax.set_xlim(xylim[0])
     
    625620                xylim = []
    626621                tb.push_current()
    627             plt.draw()
     622            self.Page.canvas.draw()
    628623       
    629624    def OnPick(self, event):
Note: See TracChangeset for help on using the changeset viewer.