def plot(self, func, interp=True, plotter='imshow'): import matplotlib as mpl from matplotlib import pylab as pl if interp: lpi = self.interpolator(func) z = lpi[self.yrange[0]:self.yrange[1]:complex(0, self.nrange), self.xrange[0]:self.xrange[1]:complex(0, self.nrange)] else: y, x = np.mgrid[ self.yrange[0]:self.yrange[1]:complex(0, self.nrange), self.xrange[0]:self.xrange[1]:complex(0, self.nrange)] z = func(x, y) z = np.where(np.isinf(z), 0.0, z) extent = (self.xrange[0], self.xrange[1], self.yrange[0], self.yrange[1]) pl.ioff() pl.clf() pl.hot() # Some like it hot if plotter == 'imshow': pl.imshow(np.nan_to_num(z), interpolation='nearest', extent=extent, origin='lower') elif plotter == 'contour': Y, X = np.ogrid[ self.yrange[0]:self.yrange[1]:complex(0, self.nrange), self.xrange[0]:self.xrange[1]:complex(0, self.nrange)] pl.contour(np.ravel(X), np.ravel(Y), z, 20) x = self.x y = self.y lc = mpl.collections.LineCollection(np.array([ ((x[i], y[i]), (x[j], y[j])) for i, j in self.tri.edge_db ]), colors=[(0, 0, 0, 0.2)]) ax = pl.gca() ax.add_collection(lc) if interp: title = '%s Interpolant' % self.name else: title = 'Reference' if hasattr(func, 'title'): pl.title('%s: %s' % (func.title, title)) else: pl.title(title) pl.show() pl.ion()
def plot(self, func, interp=True, plotter='imshow'): import matplotlib as mpl from matplotlib import pylab as pl if interp: lpi = self.interpolator(func) z = lpi[self.yrange[0]:self.yrange[1]:complex(0, self.nrange), self.xrange[0]:self.xrange[1]:complex(0, self.nrange)] else: y, x = np.mgrid[ self.yrange[0]:self.yrange[1]:complex(0, self.nrange), self.xrange[0]:self.xrange[1]:complex(0, self.nrange)] z = func(x, y) z = np.where(np.isinf(z), 0.0, z) extent = (self.xrange[0], self.xrange[1], self.yrange[0], self.yrange[1]) pl.ioff() pl.clf() pl.hot() # Some like it hot if plotter == 'imshow': pl.imshow(np.nan_to_num(z), interpolation='nearest', extent=extent, origin='lower') elif plotter == 'contour': Y, X = np.ogrid[ self.yrange[0]:self.yrange[1]:complex(0, self.nrange), self.xrange[0]:self.xrange[1]:complex(0, self.nrange)] pl.contour(np.ravel(X), np.ravel(Y), z, 20) x = self.x y = self.y lc = mpl.collections.LineCollection( np.array([((x[i], y[i]), (x[j], y[j])) for i, j in self.tri.edge_db]), colors=[(0, 0, 0, 0.2)]) ax = pl.gca() ax.add_collection(lc) if interp: title = '%s Interpolant' % self.name else: title = 'Reference' if hasattr(func, 'title'): pl.title('%s: %s' % (func.title, title)) else: pl.title(title) pl.show() pl.ion()
def decision_boundary_plot(svm, features, vectors, labels, kernel, fileName = None, **args) : title = None if 'title' in args : title = args['title'] xlabel = None if 'xlabel' in args : xlabel = args['xlabel'] ylabel = None if 'ylabel' in args : ylabel = args['ylabel'] fontsize = 'medium' if 'fontsize' in args : fontsize = args['fontsize'] contourFontsize = 10 if 'contourFontsize' in args : contourFontsize = args['contourFontsize'] showColorbar = True if 'showColorbar' in args : showColorbar = args['showColorbar'] show = True if fileName is not None : show = False if 'show' in args : show = args['show'] # setting up the grid delta = 0.005 x = arange(xmin, xmax, delta) y = arange(ymin, ymax, delta) Z = numpy.zeros((len(x), len(y)), numpy.float_) gridX = numpy.zeros((len(x) *len(y), 2), numpy.float_) n = 0 for i in range(len(x)) : for j in range(len(y)) : gridX[n][0] = x[i] gridX[n][1] = y[j] n += 1 if kernel.get_name() == 'Linear' and 'customwandb' in args: kernel.init_optimization_svm(svm) b=svm.get_bias() w=kernel.get_w() kernel.set_w(args['customwandb'][0]) svm.set_bias(args['customwandb'][1]) if kernel.get_name() == 'Linear' and 'drawarrow' in args: kernel.init_optimization_svm(svm) b=svm.get_bias() w=kernel.get_w() s=1.0/numpy.dot(w,w)/1.17 pylab.arrow(0,-b/w[1], w[0]*s,s*w[1], width=0.01, fc='#dddddd', ec='k') grid_features = RealFeatures(numpy.transpose(gridX)) results = svm_test(svm, kernel, features, grid_features) n = 0 for i in range(len(x)) : for j in range(len(y)) : Z[i][j] = results[n] n += 1 cdict = {'red' :((0.0, 0.6, 0.6),(0.5, 0.8, 0.8),(1.0, 1.0, 1.0)), 'green':((0.0, 0.6, 0.6),(0.5, 0.8, 0.8),(1.0, 1.0, 1.0)), 'blue' :((0.0, 0.6, 0.6),(0.5, 0.8, 0.8),(1.0, 1.0, 1.0)), } my_cmap = matplotlib.colors.LinearSegmentedColormap('lightgray',cdict,256) im = pylab.imshow(numpy.transpose(Z), interpolation='bilinear', origin='lower', cmap=my_cmap, extent=(xmin,xmax,ymin,ymax) ) if 'decisionboundaryonly' in args: C1 = pylab.contour(numpy.transpose(Z), [0], origin='lower', linewidths=(3), colors = ['k'], extent=(xmin,xmax,ymin,ymax)) else: C1 = pylab.contour(numpy.transpose(Z), [-1,0,1], origin='lower', linewidths=(1,3,1), colors = ['k','k'], extent=(xmin,xmax,ymin,ymax)) pylab.clabel(C1, inline=1, fmt='%1.1f', fontsize=contourFontsize) # plot the data lab=labels.get_labels() vec=numpy.array(vectors) idx=numpy.where(lab==-1)[0] pylab.scatter(vec[idx,0], vec[idx,1], s=300, c='#4444ff', marker='o', alpha=0.8, zorder=100) idx=numpy.where(lab==+1)[0] pylab.scatter(vec[idx,0], vec[idx,1], s=500, c='#ff4444', marker='s', alpha=0.8, zorder=100) # plot SVs if not 'decisionboundaryonly' in args: training_outputs = svm_test(svm, kernel, features, features) sv_idx=numpy.where(abs(training_outputs)<=1.01)[0] pylab.scatter(vec[sv_idx,0], vec[sv_idx,1], s=100, c='k', marker='o', alpha=0.8, zorder=100) if 'showmovedpoint' in args: x=-0.779838709677 y=-0.1375 pylab.scatter([x], [y], s=300, c='#4e4e61', marker='o', alpha=1, zorder=100, edgecolor='#454548') pylab.arrow(x,y-0.1, 0, -0.8/1.5, width=0.01, fc='#dddddd', ec='k') #pylab.show() if title is not None : pylab.title(title, fontsize=fontsize) if ylabel: pylab.ylabel(ylabel,fontsize=fontsize) if xlabel: pylab.xlabel(xlabel,fontsize=fontsize) if showColorbar : pylab.colorbar(im) # colormap: pylab.hot() if fileName is not None : pylab.savefig(fileName) if show : pylab.show()
def decision_boundary_plot(svm, features, vectors, labels, kernel, fileName=None, **args): title = None if 'title' in args: title = args['title'] xlabel = None if 'xlabel' in args: xlabel = args['xlabel'] ylabel = None if 'ylabel' in args: ylabel = args['ylabel'] fontsize = 'medium' if 'fontsize' in args: fontsize = args['fontsize'] contourFontsize = 10 if 'contourFontsize' in args: contourFontsize = args['contourFontsize'] showColorbar = True if 'showColorbar' in args: showColorbar = args['showColorbar'] show = True if fileName is not None: show = False if 'show' in args: show = args['show'] # setting up the grid delta = 0.005 x = arange(xmin, xmax, delta) y = arange(ymin, ymax, delta) Z = numpy.zeros((len(x), len(y)), numpy.float_) gridX = numpy.zeros((len(x) * len(y), 2), numpy.float_) n = 0 for i in range(len(x)): for j in range(len(y)): gridX[n][0] = x[i] gridX[n][1] = y[j] n += 1 if kernel.get_name() == 'Linear' and 'customwandb' in args: kernel.init_optimization_svm(svm) b = svm.get_bias() w = kernel.get_w() kernel.set_w(args['customwandb'][0]) svm.set_bias(args['customwandb'][1]) if kernel.get_name() == 'Linear' and 'drawarrow' in args: kernel.init_optimization_svm(svm) b = svm.get_bias() w = kernel.get_w() s = 1.0 / numpy.dot(w, w) / 1.17 pylab.arrow(0, -b / w[1], w[0] * s, s * w[1], width=0.01, fc='#dddddd', ec='k') grid_features = RealFeatures(numpy.transpose(gridX)) results = svm_test(svm, kernel, features, grid_features) n = 0 for i in range(len(x)): for j in range(len(y)): Z[i][j] = results[n] n += 1 cdict = { 'red': ((0.0, 0.6, 0.6), (0.5, 0.8, 0.8), (1.0, 1.0, 1.0)), 'green': ((0.0, 0.6, 0.6), (0.5, 0.8, 0.8), (1.0, 1.0, 1.0)), 'blue': ((0.0, 0.6, 0.6), (0.5, 0.8, 0.8), (1.0, 1.0, 1.0)), } my_cmap = matplotlib.colors.LinearSegmentedColormap( 'lightgray', cdict, 256) im = pylab.imshow(numpy.transpose(Z), interpolation='bilinear', origin='lower', cmap=my_cmap, extent=(xmin, xmax, ymin, ymax)) if 'decisionboundaryonly' in args: C1 = pylab.contour(numpy.transpose(Z), [0], origin='lower', linewidths=(3), colors=['k'], extent=(xmin, xmax, ymin, ymax)) else: C1 = pylab.contour(numpy.transpose(Z), [-1, 0, 1], origin='lower', linewidths=(1, 3, 1), colors=['k', 'k'], extent=(xmin, xmax, ymin, ymax)) pylab.clabel(C1, inline=1, fmt='%1.1f', fontsize=contourFontsize) # plot the data lab = labels.get_labels() vec = numpy.array(vectors) idx = numpy.where(lab == -1)[0] pylab.scatter(vec[idx, 0], vec[idx, 1], s=300, c='#4444ff', marker='o', alpha=0.8, zorder=100) idx = numpy.where(lab == +1)[0] pylab.scatter(vec[idx, 0], vec[idx, 1], s=500, c='#ff4444', marker='s', alpha=0.8, zorder=100) # plot SVs if not 'decisionboundaryonly' in args: training_outputs = svm_test(svm, kernel, features, features) sv_idx = numpy.where(abs(training_outputs) <= 1.01)[0] pylab.scatter(vec[sv_idx, 0], vec[sv_idx, 1], s=100, c='k', marker='o', alpha=0.8, zorder=100) if 'showmovedpoint' in args: x = -0.779838709677 y = -0.1375 pylab.scatter([x], [y], s=300, c='#4e4e61', marker='o', alpha=1, zorder=100, edgecolor='#454548') pylab.arrow(x, y - 0.1, 0, -0.8 / 1.5, width=0.01, fc='#dddddd', ec='k') #pylab.show() if title is not None: pylab.title(title, fontsize=fontsize) if ylabel: pylab.ylabel(ylabel, fontsize=fontsize) if xlabel: pylab.xlabel(xlabel, fontsize=fontsize) if showColorbar: pylab.colorbar(im) # colormap: pylab.hot() if fileName is not None: pylab.savefig(fileName) if show: pylab.show()
#% For any number of bars beyond 4, just make up random colors. if numberOfBars > 4.: barColorMap[4:numberOfBars,0:3.] = np.random.rand((numberOfBars-4.), 3.) elif button == 2.: #% Example of using colormap with random colors barColorMap = np.random.rand(numberOfBars, 3.) elif button == 3.: #% Example of using pre-defined jet colormap barColorMap = plt.jet(numberOfBars) elif button == 4.: #% Example of using pre-defined Hot colormap barColorMap = plt.hot(numberOfBars) else: #% Example of using pre-defined lines colormap barColorMap = lines(numberOfBars) #% Plot each number one at a time, calling bar() for each y value. for b in np.arange(1., (numberOfBars)+1): #% Plot one single bar as a separate bar series. #% Fancy up the graph. plt.grid(on) caption = sprintf('Data plotted in %d barseries, each with a different color', length(y)) plt.title(caption, 'FontSize', fontSize) plt.xlabel('x', 'FontSize', fontSize)
def decisionSurface(classifier, fileName=None, **args): global data global numpy_container classifier.train(data) numContours = 3 if 'numContours' in args: numContours = args['numContours'] title = None if 'title' in args: title = args['title'] markersize = 5 fontsize = 'medium' if 'markersize' in args: markersize = args['markersize'] if 'fontsize' in args: fontsize = args['fontsize'] contourFontsize = 10 if 'contourFontsize' in args: contourFontsize = args['contourFontsize'] showColorbar = False if 'showColorbar' in args: showColorbar = args['showColorbar'] show = True if fileName is not None: show = False if 'show' in args: show = args['show'] # setting up the grid delta = 0.01 if 'delta' in args: delta = args['delta'] x = arange(xmin, xmax, delta) y = arange(ymin, ymax, delta) Z = numpy.zeros((len(x), len(y)), numpy.float) gridX = numpy.zeros((len(x) * len(y), 2), numpy.float) n = 0 for i in range(len(x)): for j in range(len(y)): gridX[n][0] = x[i] gridX[n][1] = y[j] n += 1 if not numpy_container: gridData = VectorDataSet(gridX) gridData.attachKernel(data.kernel) else: gridData = PyVectorDataSet(gridX) results = classifier.test(gridData) n = 0 for i in range(len(x)): for j in range(len(y)): Z[i][j] = results.decisionFunc[n] n += 1 #pylab.figure() im = pylab.imshow(numpy.transpose(Z), interpolation='bilinear', origin='lower', cmap=pylab.cm.gray, extent=(xmin, xmax, ymin, ymax)) if numContours == 1: C = pylab.contour(numpy.transpose(Z), [0], origin='lower', linewidths=(3), colors='black', extent=(xmin, xmax, ymin, ymax)) elif numContours == 3: C = pylab.contour(numpy.transpose(Z), [-1, 0, 1], origin='lower', linewidths=(1, 3, 1), colors='black', extent=(xmin, xmax, ymin, ymax)) else: C = pylab.contour(numpy.transpose(Z), numContours, origin='lower', linewidths=2, extent=(xmin, xmax, ymin, ymax)) pylab.clabel(C, inline=1, fmt='%1.1f', fontsize=contourFontsize) # plot the data scatter(data, markersize=markersize) xticklabels = pylab.getp(pylab.gca(), 'xticklabels') yticklabels = pylab.getp(pylab.gca(), 'yticklabels') pylab.setp(xticklabels, fontsize=fontsize) pylab.setp(yticklabels, fontsize=fontsize) if title is not None: pylab.title(title, fontsize=fontsize) if showColorbar: pylab.colorbar(im) # colormap: pylab.hot() if fileName is not None: pylab.savefig(fileName) if show: pylab.show()
def decisionSurface(classifier, fileName = None, **args) : global data global numpy_container classifier.train(data) numContours = 3 if 'numContours' in args : numContours = args['numContours'] title = None if 'title' in args : title = args['title'] markersize=5 fontsize = 'medium' if 'markersize' in args : markersize = args['markersize'] if 'fontsize' in args : fontsize = args['fontsize'] contourFontsize = 10 if 'contourFontsize' in args : contourFontsize = args['contourFontsize'] showColorbar = False if 'showColorbar' in args : showColorbar = args['showColorbar'] show = True if fileName is not None : show = False if 'show' in args : show = args['show'] # setting up the grid delta = 0.01 if 'delta' in args : delta = args['delta'] x = arange(xmin, xmax, delta) y = arange(ymin, ymax, delta) Z = numpy.zeros((len(x), len(y)), numpy.float) gridX = numpy.zeros((len(x) *len(y), 2), numpy.float) n = 0 for i in range(len(x)) : for j in range(len(y)) : gridX[n][0] = x[i] gridX[n][1] = y[j] n += 1 if not numpy_container : gridData = VectorDataSet(gridX) gridData.attachKernel(data.kernel) else : gridData = PyVectorDataSet(gridX) results = classifier.test(gridData) n = 0 for i in range(len(x)) : for j in range(len(y)) : Z[i][j] = results.decisionFunc[n] n += 1 #pylab.figure() im = pylab.imshow(numpy.transpose(Z), interpolation='bilinear', origin='lower', cmap=pylab.cm.gray, extent=(xmin,xmax,ymin,ymax) ) if numContours == 1 : C = pylab.contour(numpy.transpose(Z), [0], origin='lower', linewidths=(3), colors = 'black', extent=(xmin,xmax,ymin,ymax)) elif numContours == 3 : C = pylab.contour(numpy.transpose(Z), [-1,0,1], origin='lower', linewidths=(1,3,1), colors = 'black', extent=(xmin,xmax,ymin,ymax)) else : C = pylab.contour(numpy.transpose(Z), numContours, origin='lower', linewidths=2, extent=(xmin,xmax,ymin,ymax)) pylab.clabel(C, inline=1, fmt='%1.1f', fontsize=contourFontsize) # plot the data scatter(data, markersize=markersize) xticklabels = pylab.getp(pylab.gca(), 'xticklabels') yticklabels = pylab.getp(pylab.gca(), 'yticklabels') pylab.setp(xticklabels, fontsize=fontsize) pylab.setp(yticklabels, fontsize=fontsize) if title is not None : pylab.title(title, fontsize=fontsize) if showColorbar : pylab.colorbar(im) # colormap: pylab.hot() if fileName is not None : pylab.savefig(fileName) if show : pylab.show()
x = np.linspace(0, 20) plt.plot(x, J(0, x), label='J0') plt.plot(x, J(1, x), label='J1') plt.plot(x, J(2, x), label='J2') plt.legend(("$J_0$", "$J_1$", "$J_2$")) plt.show() # part(b) lamda = 0.5 k = 2 * np.pi / lamda r = np.linspace(0, 1e-6) x, y = np.mgrid[-1:1:100j, -1:1:100j] # print(x, y) r = np.sqrt(x**2 + y**2) I = (J(1, r * k) / k / r)**2 plt.imshow(I, vmax=0.01) plt.hot() plt.title( " Density plot of the intensity of the circular diffraction pattern of a point light source" ) plt.show() plt.show()
def main(self, fname=None, show=False, figurename=None, save=False, along_orbit=False, set_cmap=True): # if len(a.digitization_list) < 100: # return if set_cmap: plt.hot() fig = plt.figure(figsize=(8.27, 11.69), dpi=70) n = 8 + 4 + 1 + 1 + 1 hr = np.ones(n) hr[-4:] = 0.5 g = mpl.gridspec.GridSpec(n,1, hspace=0.1, height_ratios=hr, bottom=0.06, right=0.89) axes = [] prev = None for i in range(n): axes.append(plt.subplot(g[i], sharex=prev)) axes[i].set_xlim(self.extent[0], self.extent[1]) axes[i].yaxis.set_major_locator( mpl.ticker.MaxNLocator(prune='upper', nbins=5, steps=[1,2,5,10])) l = celsius.SpiceetLocator() axes[i].xaxis.set_major_locator(l) axes[i].xaxis.set_major_formatter( celsius.SpiceetFormatter(locator=l)) prev = axes[-1] axit = iter(axes) self.plot_aspera_ima(ax=next(axit), inverted=False) self.plot_aspera_els(ax=next(axit)) self.plot_mod_b(ax=next(axit)) self.plot_ne(ax=next(axit)) self.plot_timeseries(ax=next(axit)) self.plot_frequency_range(ax=next(axit), f_min=0.0, f_max=0.2, colorbar=True) # self.plot_frequency_range(ax=axit.next(), f_min=0.2, f_max=0.5) self.plot_frequency(ax=next(axit), f=0.5) # self.plot_frequency(ax=axit.next(), f=0.75) self.plot_frequency(ax=next(axit), f=1.) # self.plot_frequency(ax=axit.next(), f=1.52) self.plot_frequency(ax=next(axit), f=2.) self.plot_tec(ax=next(axit)) # twx = plt.twinx() # t = mex.sub_surface.read_tec(self.start_time, self.finish_time) # good = t['FLAG'] == 1 # plt.plot(t['EPHEMERIS_TIME'][good], t['TEC'][good], 'k.', mew=0.) # plt.ylabel(r'$TEC / m^{-2}$') # plt.yscale('log') # plt.ylim(3E13, 2E16) # self.plot_profiles(ax=axit.next()) # self.plot_profiles_delta(ax=axit.next()) # self.plot_peak_altitude(ax=axit.next()) # self.plot_peak_density(ax=axit.next()) self.plot_profiles(ax=next(axit)) # self.plot_tec(ax=axit.next()) self.plot_altitude(ax=next(axit)) self.plot_lat(ax=next(axit)) self.plot_lon(ax=next(axit)) self.plot_sza(ax=next(axit)) # axes[-1].xaxis.set_major_formatter(celsius.SpiceetFormatter()) for i in range(n-1): plt.setp( axes[i].get_xticklabels(), visible=False ) axes[i].set_xlim(self.extent[0], self.extent[1]) l = celsius.SpiceetLocator() axes[i].xaxis.set_major_locator(l) axes[i].xaxis.set_major_formatter( celsius.SpiceetFormatter(locator=l)) plt.annotate("Orbit %d, plot start: %s, newest digitization: %s" % ( self.orbit, celsius.spiceet_to_utcstr(self.extent[0],fmt='C')[0:17], self._newest), (0.5, 0.93), xycoords='figure fraction', ha='center') if save: if figurename is None: fname = mex.locate_data_directory() + ('ais_plots/v0.9/%05d/%d.pdf' % ((self.orbit // 1000) * 1000, self.orbit)) else: fname = figurename print('Writing %s' % fname) d = os.path.dirname(fname) if not os.path.exists(d) and d: os.makedirs(d) plt.savefig(fname) if show: plt.show() else: plt.close(fig) plt.close('all') if along_orbit: # fig = plt.figure() fig, ax = plt.subplots(2, 1, squeeze=True, figsize=(4,4), dpi=70, num=plt.gcf().number + 1) plt.subplots_adjust(hspace=0.3,wspace=0.0, right=0.85) self.density_along_orbit(ax[0], vmax=4.) self.modb_along_orbit(ax[1], vmax=100.) if save: fname = mex.locate_data_directory() + ('ais_plots/A0_v0.9/%05d/%d.pdf' % ((self.orbit // 1000) * 1000, self.orbit)) print('Writing %s' % fname) d = os.path.dirname(fname) if not os.path.exists(d): os.makedirs(d) plt.savefig(fname) if show: plt.show() else: plt.close(fig) plt.close('all')
header['CRPIX2'] -= header['NAXIS2'] / 2 - n / 2 # correct for wrong centering #header['CRPIX1'] += 7 #header['CRPIX2'] += 7 # header['NAXIS1'] = n header['NAXIS2'] = n # reload data with new header tod, projection, header, obs = csh.load_data(filenames, header=header) # get weighted backprojection bpj = projection.transpose(tod) weights = projection.transpose(tod.ones(tod.shape)) pipe = bpj / weights # get the model dense matrix P = lo.aslinearoperator(projection.aslinearoperator()) C = csh.averaging(tod.shape, factor) M = C * P Md = M.todense() MtMd = (M.T * M).todense() Pd = P.todense() PtPd = (P.T * P).todense() plt.imshow(MtMd, interpolation="nearest") a = plt.gca() a.set_xticks(()) a.set_yticks(()) plt.show() plt.hot()
#do_regular_survey(copy.deepcopy(routes),Preal,P,M,S,X,D,opts) # plot the results - regular survey path_colours = ['b','g','b'] path_linestyles = ['-','--','-.'] pylab.figure() pylab.matshow(Preal[:,:,1],fignum=0) for g in range(opts['num_groups']): pylab.plot(routes[g][:,1],routes[g][:,0],c=path_colours[g],ls=path_linestyles[g],linewidth=2) for k in range(opts['stops_per_group']): pylab.plot(survey_locations_by_group_reg[g][k][1],survey_locations_by_group_reg[g][k][0], ls='None',marker='o',color=path_colours[g],markersize=10,markeredgewidth=2) pylab.title(r'$w(I(x))=1$') pylab.hot() ax = pylab.gca() ax.set_xlim(0,100) ax.set_ylim(100,0) ax.set_xticks([]) ax.set_yticks([]) if save_figures: pylab.gca().set_xticks([]) pylab.gca().set_yticks([]) pylab.gcf().set_figwidth(3.5) pylab.gcf().set_figheight(3.5) pylab.savefig('locations-regular.pdf', bbox_inches='tight') # plot the results - optimised survey