當前位置: 首頁>>代碼示例>>Python>>正文


Python Pgplot.plot2d方法代碼示例

本文整理匯總了Python中Pgplot.plot2d方法的典型用法代碼示例。如果您正苦於以下問題:Python Pgplot.plot2d方法的具體用法?Python Pgplot.plot2d怎麽用?Python Pgplot.plot2d使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Pgplot的用法示例。


在下文中一共展示了Pgplot.plot2d方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: greyscale

# 需要導入模塊: import Pgplot [as 別名]
# 或者: from Pgplot import plot2d [as 別名]
 def greyscale(self, array2d, **kwargs):
     """
     greyscale(array2d, **kwargs):
         Plot a 2D array as a greyscale image using the same scalings
             as in prepfold.
     """
     # Use the same scaling as in prepfold_plot.c
     global_max = Num.maximum.reduce(Num.maximum.reduce(array2d))
     min_parts = Num.minimum.reduce(array2d, 1)
     array2d = (array2d-min_parts[:,Num.newaxis])/Num.fabs(global_max)
     Pgplot.plot2d(array2d, image='antigrey', **kwargs)
開發者ID:zhuww,項目名稱:ubc_AI,代碼行數:13,代碼來源:prepfold.py

示例2: show_ffdot_plane

# 需要導入模塊: import Pgplot [as 別名]
# 或者: from Pgplot import plot2d [as 別名]
def show_ffdot_plane(data, r, z, dr = 0.125, dz = 0.5,
                     numr = 300, numz = 300, T = None, 
                     contours = None, title = None, 
                     image = "astro", device = "/XWIN", norm = 1.0):
   """
   show_ffdot_plane(data, r, z):
       Show a color plot of the F-Fdot plane centered on the point 'r', 'z'.
   """
   ffdp = ffdot_plane(data, r, dr, numr, z, dz, numz)
   ffdpow = spectralpower(ffdp.ravel())
   ffdpow.shape = (numz, numr)
   startbin = int(r - (numr * dr) / 2)
   startz = int(z - (numz * dz) / 2)
   x = np.arange(numr, dtype="d") * dr + startbin
   y = np.arange(numz, dtype="d") * dz + startz
   highpt = np.argmax(ffdpow.ravel())
   hir = highpt % numr
   hiz = highpt / numr
   print ""
   print "Fourier Freqs from ", min(x), "to", max(x), "."
   print "Fourier Fdots from ", min(y), "to", max(y), "."
   print "Maximum normalized power is ", ffdpow[hiz][hir]
   print "The max value is located at:  r =", startbin + hir * dr, \
         "  z =", startz + hiz * dz
   print ""
   if not T:
      Pgplot.plot2d(ffdpow, x, y, labx = "Fourier Frequency (bins)", \
                    laby = "Fourier Frequency Derivative", \
                    title = title, image = image, \
                    contours = contours, device = device)
   else:
      Pgplot.plot2d(ffdpow, x/T, y/(T**2.0), labx = "Frequency (hz)", \
                    laby = "Frequency Derivative (Hz/sec)", \
                    rangex2 = [x[0], x[-1]], rangey2 = [y[0], y[-1]], \
                    labx2 = "Fourier Frequency", \
                    laby2 = "Fourier Frequency Derivative", \
                    title = title, image = image, \
                    contours = contours, device = device)
開發者ID:kernsuite-debian,項目名稱:presto,代碼行數:40,代碼來源:__init__.py

示例3: argmax

# 需要導入模塊: import Pgplot [as 別名]
# 或者: from Pgplot import plot2d [as 別名]
 maxarg = argmax(spectralpower(ffd.flat))
 rind = maxarg % numr
 zind = maxarg / numr
 peakr = (rind * dr + int(tryr - (numr * dr) / 2.0))
 peakz = (zind * dz + tryz - (numz * dz) / 2.0)
 peakpow = ffd[zind][rind].real**2 + \
           ffd[zind][rind].imag**2
 if showplots:
     xvals = arange(numr, typecode="d") * dr + \
             int(tryr - (numr * dr) / 2.0)
     yvals = arange(numz, typecode="d") * dz + \
             tryz - (numz * dz) / 2.0
     ffdpow = spectralpower(ffd.flat)
     ffdpow.shape = (numz, numr)
     Pgplot.plot2d(ffdpow, xvals, yvals, \
                   labx="Fourier Freq (bins)", \
                   laby="Fourier Freq Deriv", \
                   image="astro")
     Pgplot.closeplot()
 if debugout:
     print 'peakr = %11.5f  peakz = %11.5f' % \
           (peakr, peakz)
 if (peakpow < 0.2):
     pows[ct] = peakpow
     rmax = peakr
     zmax = peakz
 else:
     [pows[ct], rmax, zmax, rd] = \
                maximize_rz(data, peakr, peakz, \
                            norm=1.0)
 if debugout:
     print 'max_r = %11.5f  max_z = %11.5f' % \
開發者ID:ChrisLaidler,項目名稱:presto,代碼行數:34,代碼來源:monte_ffdot.py


注:本文中的Pgplot.plot2d方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。