Python pylab.semilogx() Examples

The following are 1 code examples of pylab.semilogx(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pylab , or try the search function .
Example #1
Source File: dataset_float_classes.py    From DEMUD with Apache License 2.0 5 votes vote down vote up
def  plot_item(self, m, ind, x, r, k, label, U,
                 rerr, feature_weights):

    if x == [] or r == []: 
      print "Error: No data in x and/or r."
      return
  
    pylab.clf()
    # xvals, x, and r need to be column vectors
    # xvals represent bin end points, so we need to duplicate most of them
    x = np.repeat(x, 2, axis=0)
    r = np.repeat(r, 2, axis=0)

    pylab.subplot(2,1,1)
    pylab.semilogx(self.xvals, r[0:128], 'r-', label='Expected')
    pylab.semilogx(self.xvals, x[0:128], 'b.-', label='Observations')
    pylab.xlabel('CTN: ' + self.xlabel)
    pylab.ylabel(self.ylabel)
    pylab.legend(loc='upper left', fontsize=10)

    pylab.subplot(2,1,2)
    pylab.semilogx(self.xvals, r[128:], 'r-', label='Expected')
    pylab.semilogx(self.xvals, x[128:], 'b.-', label='Observations')
    pylab.xlabel('CETN: ' + self.xlabel)
    pylab.ylabel(self.ylabel)
    pylab.legend(loc='upper left', fontsize=10)

    pylab.suptitle('DEMUD selection %d (%s), item %d, using K=%d' % \
                (m, label, ind, k))
  
    outdir = os.path.join('results', self.name)
    if not os.path.exists(outdir):
      os.mkdir(outdir)
    figfile = os.path.join(outdir, 'sel-%d-k-%d-(%s).pdf' % (m, k, label))
    pylab.savefig(figfile)
    print 'Wrote plot to %s' % figfile
    pylab.close()