Changeset 1696


Ignore:
Timestamp:
02/11/10 11:45:38 (14 years ago)
Author:
Malte Marquarding
Message:

Tidy up plotazel and plotpointing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asapplotter.py

    r1695 r1696  
    876876    def plotazel(self):
    877877        """
    878         plot azimuth and elevation  versus time of a scantable
    879         """
    880         import pylab as PL
    881         from matplotlib.dates import DateFormatter, timezone, HourLocator, MinuteLocator, DayLocator
     878        plot azimuth and elevation versus time of a scantable
     879        """
     880        from matplotlib import pylab as PL
     881        from matplotlib.dates import DateFormatter, timezone
     882        from matplotlib.dates import HourLocator, MinuteLocator,SecondLocator, DayLocator
    882883        from matplotlib.ticker import MultipleLocator
    883884        from matplotlib.numerix import array, pi
     
    899900            minloc = HourLocator(range(0,23,12))
    900901            timefmt = DateFormatter("%b%d")
     902        elif tdel > 24./60.:
     903            timefmt = DateFormatter('%H:%M')
     904            majloc = HourLocator()
     905            minloc = MinuteLocator(30)
    901906        else:
    902             timefmt = DateFormatter('%H')
    903             majloc = HourLocator()
    904             minloc = MinuteLocator(20)
     907            timefmt = DateFormatter('%H:%M')
     908            majloc = MinuteLocator(interval=5)
     909            minloc = SecondLocator(30)
     910
    905911        PL.title(dstr)
    906912        PL.plot_date(t,el,'b,', tz=tz)
    907         #ax.grid(True)
    908913        ax.yaxis.grid(True)
    909         yloc = MultipleLocator(30)
    910         ax.set_ylim(0,90)
    911         ax.xaxis.set_major_formatter(timefmt)
    912         ax.xaxis.set_major_locator(majloc)
    913         ax.xaxis.set_minor_locator(minloc)
    914         ax.yaxis.set_major_locator(yloc)
     914
    915915        if tdel > 1.0:
    916916            labels = ax.get_xticklabels()
     
    923923                if az[irow] < 0: az[irow] += 360.0
    924924
    925         ax = PL.subplot(2,1,2)
    926         PL.xlabel('Time (UT)')
    927         PL.ylabel('Az [deg.]')
    928         PL.plot_date(t,az,'b,', tz=tz)
    929         ax.set_ylim(0,360)
    930         #ax.grid(True)
    931         ax.yaxis.grid(True)
    932         #hfmt = DateFormatter('%H')
    933         #hloc = HourLocator()
    934         yloc = MultipleLocator(60)
     925        ax2 = ax.figure.add_subplot(2,1,2, sharex=ax)
     926        ax2.set_xlabel('Time (UT)')
     927        ax2.set_ylabel('Az [deg.]')
     928        ax2.plot_date(t,az,'b,', tz=tz)
     929        ax2.yaxis.grid(True)
     930        # set this last as x axis is shared
    935931        ax.xaxis.set_major_formatter(timefmt)
    936932        ax.xaxis.set_major_locator(majloc)
    937933        ax.xaxis.set_minor_locator(minloc)
    938         ax.yaxis.set_major_locator(yloc)
    939         if tdel > 1.0:
    940             labels = ax.get_xticklabels()
    941             PL.setp(labels, fontsize=10)
    942934        PL.ion()
    943935        PL.draw()
     
    947939        plot telescope pointings
    948940        """
    949         import pylab as PL
    950         from matplotlib.dates import DateFormatter, timezone
    951         from matplotlib.ticker import MultipleLocator
    952         from matplotlib.numerix import array, pi, zeros
     941        from matplotlib import pylab as PL
     942        from matplotlib.numerix import array
    953943        dir = array(self._data.get_directionval()).transpose()
    954944        ra = dir[0]*180./pi
     
    960950        ax = PL.axes([0.1,0.1,0.8,0.8])
    961951        ax.set_aspect('equal')
    962         PL.plot(ra,dec, 'b,')
     952        PL.plot(ra, dec, 'b,')
    963953        PL.xlabel('RA [deg.]')
    964954        PL.ylabel('Declination [deg.]')
Note: See TracChangeset for help on using the changeset viewer.