Ignore:
Timestamp:
04/22/11 18:21:29 (13 years ago)
Author:
Kana Sugimoto
Message:

New Development: No

JIRA Issue: No (a fix)

Ready for Test: Yes

Interface Changes: added a new method new_asaplot() to module asapplotter which returns asaplot instance based on your backend selection.

What Interface Changed:

Test Programs: sdaverage, sdsmooth with verify=True and plotlevel > 0

Put in Release Notes: No

Module(s):

Description: proper handling of plotting in non-TkAgg? backend.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/scantable.py

    r2144 r2150  
    20302030
    20312031        if plot:
    2032             if rcParams['plotter.gui']:
    2033                 from asap.asaplotgui import asaplotgui as asaplot
    2034             else:
    2035                 from asap.asaplot import asaplot
    2036             self._p=asaplot()
    2037             self._p.set_panels()
     2032            from asap.asapplotter import new_asaplot
     2033            theplot = new_asaplot(rcParams['plotter.gui'])
     2034            theplot.set_panels()
    20382035            ylab=s._get_ordinate_label()
    2039             #self._p.palette(0,["#777777","red"])
     2036            #theplot.palette(0,["#777777","red"])
    20402037            for r in xrange(s.nrow()):
    20412038                xsm=s._getabcissa(r)
     
    20432040                xorg=orgscan._getabcissa(r)
    20442041                yorg=orgscan._getspectrum(r)
    2045                 self._p.clear()
    2046                 self._p.hold()
    2047                 self._p.set_axes('ylabel',ylab)
    2048                 self._p.set_axes('xlabel',s._getabcissalabel(r))
    2049                 self._p.set_axes('title',s._getsourcename(r))
    2050                 self._p.set_line(label='Original',color="#777777")
    2051                 self._p.plot(xorg,yorg)
    2052                 self._p.set_line(label='Smoothed',color="red")
    2053                 self._p.plot(xsm,ysm)
     2042                theplot.clear()
     2043                theplot.hold()
     2044                theplot.set_axes('ylabel',ylab)
     2045                theplot.set_axes('xlabel',s._getabcissalabel(r))
     2046                theplot.set_axes('title',s._getsourcename(r))
     2047                theplot.set_line(label='Original',color="#777777")
     2048                theplot.plot(xorg,yorg)
     2049                theplot.set_line(label='Smoothed',color="red")
     2050                theplot.plot(xsm,ysm)
    20542051                ### Ugly part for legend
    20552052                for i in [0,1]:
    2056                     self._p.subplots[0]['lines'].append([self._p.subplots[0]['axes'].lines[i]])
    2057                 self._p.release()
     2053                    theplot.subplots[0]['lines'].append([theplot.subplots[0]['axes'].lines[i]])
     2054                theplot.release()
    20582055                ### Ugly part for legend
    2059                 self._p.subplots[0]['lines']=[]
     2056                theplot.subplots[0]['lines']=[]
    20602057                res = raw_input("Accept smoothing ([y]/n): ")
    20612058                if res.upper() == 'N':
    20622059                    s._setspectrum(yorg, r)
    2063             self._p.unmap()
    2064             self._p = None
     2060            theplot.quit()
     2061            del theplot
    20652062            del orgscan
    20662063
Note: See TracChangeset for help on using the changeset viewer.