Changeset 3968


Ignore:
Timestamp:
May 11, 2019 1:05:52 PM (2 years ago)
Author:
vondreele
Message:

add grid control to absorb & fprime

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Absorb.py

    r3967 r3968  
    1010import numpy as np
    1111import sys
     12import matplotlib as mpl
    1213import GSASIIpath
    1314GSASIIpath.SetVersionNumber("$Revision: 3765 $")
     
    570571        self.UpDateAbsPlot(self.Wave,rePlot=False)
    571572       
     573    def OnKeyPress(self,event):
     574        if event.key == 'g':
     575            mpl.rcParams['axes.grid'] = not mpl.rcParams['axes.grid']
     576            self.UpDateAbsPlot(self.Wave,rePlot=False)
     577
    572578    def UpDateAbsPlot(self,Wave,rePlot=True):
    573579        """Plot mu vs wavelength 0.05-3.0A"""
     
    583589            self.Page.canvas.mpl_connect('button_release_event', self.OnRelease)
    584590            self.Page.canvas.mpl_connect('motion_notify_event', self.OnMotion)
     591            self.Page.canvas.mpl_connect('key_press_event', self.OnKeyPress)
    585592            newPlot = True
    586         ax = self.Page.figure.add_subplot(111)
     593            ax = self.Page.figure.add_subplot(111,label='absorb')
     594        self.Page.Choice = (' key press','g: toggle grid',)
     595        self.Page.keyPress = self.OnKeyPress   
    587596        ax.clear()
    588597        ax.set_title('X-Ray Absorption',x=0,ha='left')
  • trunk/fprime.py

    r3967 r3968  
    1010import numpy as np
    1111import sys
     12import matplotlib as mpl
    1213import GSASIIpath
    1314GSASIIpath.SetVersionNumber("$Revision: 3765 $")
     
    325326        self.SetWaveEnergy(Wave)
    326327       
     328    def OnKeyPress(self,event):
     329        if event.key == 'g':
     330            mpl.rcParams['axes.grid'] = not mpl.rcParams['axes.grid']
     331            self.SetWaveEnergy(self.Wave)           
     332
    327333    def UpDateFPlot(self,Wave,rePlot=True):
    328334        """Plot f' & f" vs wavelength 0.05-3.0A"""
     
    341347            self.Page.canvas.mpl_connect('button_release_event', self.OnRelease)
    342348            self.Page.canvas.mpl_connect('motion_notify_event', self.OnMotion)
     349            self.Page.canvas.mpl_connect('key_press_event', self.OnKeyPress)
    343350            newPlot = True
     351        self.Page.Choice = (' key press','g: toggle grid',)
     352        self.Page.keyPress = self.OnKeyPress   
    344353        self.fplot.set_visible(False)
    345354        ax = self.Page.figure.add_subplot(211)
Note: See TracChangeset for help on using the changeset viewer.