def plot_emp_dist(dist_type, emp_dist, colname, fpath): '''Plot a CDF or CCDF''' fig = PdfPages(fpath + '.pdf') ax = emp_dist.plot() if emp_dist.index.values.std() > co.LOGX_LIM: try: ax.semilogx() except: ax.set_xscale(u'linear') print 'Data seems not to be heavy-tailed. No log-scaling.' ax.set_xlabel(printing.get_xlabel( colname )) ax.set_ylabel(printing.get_ylabel( dist_type )) fig.savefig() fig.close() plt.close()
def plot_rankview(series, fpath): fig = PdfPages(fpath + '.pdf') ax = plt.subplot(111) if type(series) == dict: for lbl in sorted(series.iterkeys()): sercpy = pan.Series(series[lbl]) sercpy.sort() plt.loglog(range(1, len(sercpy) + 1), sercpy[::-1], '-', label=lbl) del sercpy ax.legend(loc='best') elif type(series) == pan.Series: sercpy = pan.Series(series) sercpy.sort() plt.loglog(range(1, len(sercpy) + 1), sercpy[::-1], 'b-') del sercpy ax.set_xlabel(printing.get_xlabel( 'rvp' )) ax.set_ylabel(printing.get_ylabel( 'rvp' )) fig.savefig() fig.close() plt.close()