Changeset 5471


Ignore:
Timestamp:
Jan 11, 2023 8:56:33 PM (11 months ago)
Author:
toby
Message:

attempted fix: mpl does not always import .figure

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIctrlGUI.py

    r5455 r5471  
    151151    import wx.lib.filebrowsebutton as wxfilebrowse
    152152    import matplotlib as mpl
     153    import matplotlib.figure as mplfig
    153154
    154155except ImportError:
     
    67776778        hSizer.Add(vSizer,1,wx.EXPAND,1)
    67786779        pltPanel = wx.Panel(self,size=(-1,-1))
    6779         self.figure = mpl.figure.Figure(dpi=100,figsize=(3,2))
     6780        self.figure = mplfig.Figure(dpi=100,figsize=(3,2))
    67806781        self.figure.subplots_adjust(right=0.99,top=0.99)
    67816782        Canvas(pltPanel, wx.ID_ANY, self.figure) # no need to save, get this from self.figure.canvas
  • trunk/GSASIIdataGUI.py

    r5452 r5471  
    451451                    warn = True
    452452                    break
    453         if s in versionDict['tooNewWarn'] and not warn:
    454             match = compareVersions(pkgver,versionDict['tooNewWarn'][s])
    455             if match >= 0:
    456                 msg += "Problems are anticipated with this version (not tested)"
    457                 warn = True
    458453        if s in versionDict['tooNewUntested'] and not warn:
    459454            match = compareVersions(pkgver,versionDict['tooNewUntested'][s])
     
    461456                msg += "New version not tested; please keep us posted"
    462457                warn = True
     458        if s in versionDict['tooNewWarn'] and not warn:
     459            match = compareVersions(pkgver,versionDict['tooNewWarn'][s])
     460            if match >= 0:
     461                msg += "Tests incomplete w/suspected bugs; Please report problems"
    463462        print("  {:12s}{}  {}".format(s+':',pkgver,msg))
    464463
  • trunk/GSASIIplot.py

    r5467 r5471  
    126126    import wx.aui
    127127    import wx.glcanvas
     128except (ImportError, ValueError):
     129    print('GSASIIplot: wx not imported')
     130try:
    128131    import matplotlib as mpl
    129132    if not mpl.get_backend():       #could be assigned by spyder debugger
    130133        mpl.use('wxAgg')
     134    import matplotlib.figure as mplfig
    131135    import matplotlib.collections as mplC
    132136    import mpl_toolkits.mplot3d.axes3d as mp3d
    133137    from scipy.ndimage.interpolation import map_coordinates
    134 except (ImportError, ValueError):
    135     pass
     138except (ImportError, ValueError) as err:
     139    print('GSASIIplot: matplotlib not imported')
     140    if GSASIIpath.GetConfigValue('debug'): print('error msg:',err)
     141
    136142import GSASIIpath
    137143Clip_on = GSASIIpath.GetConfigValue('Clip_on',True)
     
    316322        mpl.rcParams['legend.fontsize'] = 10
    317323        mpl.rcParams['axes.grid'] = False
    318         self.figure = mpl.figure.Figure(dpi=dpi,figsize=(5,6))
     324        self.figure = mplfig.Figure(dpi=dpi,figsize=(5,6))
    319325        self.canvas = Canvas(self,-1,self.figure)
    320326        self.toolbar = GSASIItoolbar(self.canvas,publish=publish)
     
    373379    def __init__(self,parent,id=-1,dpi=None,**kwargs):
    374380        _tabPlotWin.__init__(self,parent,id=id,**kwargs)
    375         self.figure = mpl.figure.Figure(dpi=dpi,figsize=(6,6))
     381        self.figure = mplfig.Figure(dpi=dpi,figsize=(6,6))
    376382        self.canvas = Canvas(self,-1,self.figure)
    377383        self.toolbar = GSASIItoolbar(self.canvas,Arrows=False)
     
    39994005        plotOpt['initNeeded'] = False
    40004006        # create a temporary hard-copy figure to get output options
    4001         figure = mpl.figure.Figure(dpi=200,figsize=(6,8))
     4007        figure = mplfig.Figure(dpi=200,figsize=(6,8))
    40024008        canvas = hcCanvas(figure)
    40034009        fmtDict = canvas.get_supported_filetypes()
     
    48374843        '''Write the current plot to a file
    48384844        '''
    4839         hcfigure = mpl.figure.Figure(dpi=plotOpt['dpi'],figsize=(plotOpt['width'],plotOpt['height']))
     4845        hcfigure = mplfig.Figure(dpi=plotOpt['dpi'],figsize=(plotOpt['width'],plotOpt['height']))
    48404846        CopyRietveldPlot(G2frame,Pattern,Plot,Page,hcfigure)
    48414847        if 'OriginPro' in plotOpt['format']:
     
    50005006
    50015007    # screen preview
    5002     figure = mpl.figure.Figure(figsize=(plotOpt['width'],plotOpt['height']))
     5008    figure = mplfig.Figure(figsize=(plotOpt['width'],plotOpt['height']))
    50035009    canvas = Canvas(dlg,-1,figure)
    50045010    vbox.Add(canvas,1,wx.ALL|wx.EXPAND,1)
     
    50365042    :param mpl.axes Plot: The axes object from the Rietveld plot
    50375043    :param wx.Panel Page: The tabbed panel for the Rietveld plot
    5038     :param mpl.figure figure: The figure object from the Rietveld plot
     5044    :param matplotlib.figure.Figure figure: The figure object from the Rietveld plot
    50395045    '''
    50405046    gs = mpl.gridspec.GridSpec(2, 1, height_ratios=[4, 1])
     
    1003010036        color wx.Colour object - doesn't work
    1003110037        '''                     
    10032         figure = mpl.figure.Figure(figsize=(1.,1.),facecolor=(0.,0.,0.,0.))
     10038        figure = mplfig.Figure(figsize=(1.,1.),facecolor=(0.,0.,0.,0.))
    1003310039        figure.clf()
    1003410040        canvas = hcCanvas(figure)
     
    1050110507            Z = np.where(Zslice<=Rmax,Zslice,Rmax)
    1050210508            ZU = np.flipud(Z)
    10503             figure = mpl.figure.Figure(figsize=(6,6),facecolor=(1.,1.,1.,.5))
     10509            figure = mplfig.Figure(figsize=(6,6),facecolor=(1.,1.,1.,.5))
    1050410510            canvas = hcCanvas(figure)
    1050510511            figure.clf()
  • trunk/GSASIItestplot.py

    r3935 r5471  
    1010import wx.aui
    1111import matplotlib as mpl
     12import matplotlib.figure as mplfig
    1213try:
    1314    from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as Canvas
     
    2324    def __init__(self, parent, id = -1, dpi = None, **kwargs):
    2425        wx.Panel.__init__(self, parent, id=id, **kwargs)
    25         self.figure = mpl.figure.Figure(dpi=dpi, #figsize=(5,7)
     26        self.figure = mplfig.Figure(dpi=dpi, #figsize=(5,7)
    2627                                        )
    2728        self.canvas = Canvas(self, -1, self.figure)
Note: See TracChangeset for help on using the changeset viewer.