def plotResults(self, times, result): nSamples = len(times) means = np.mean(result[0, :, :], 0) / 1e6 mins = np.min(result[0, :, :], 0) / 1e6 maxs = np.max(result[0, :, :], 0) / 1e6 plotMeans = [(times[i], means[i]) for i in range(nSamples)] plotMins = [(times[i], mins[i]) for i in range(nSamples)] plotMaxs = [(times[i], maxs[i]) for i in range(nSamples)] return sum([ list_plot(plotMeans, plotjoined=True, color='red'), list_plot(plotMins, plotjoined=True, color='red'), list_plot(plotMaxs, plotjoined=True, color='red') ])
def mu_portrait(n): """ returns an encoded scatter plot of the nth roots of unity in the complex plane """ if n <= 120: plot = list_plot([(cos(2*pi*m/n),sin(2*pi*m/n)) for m in range(n)],pointsize=30+60/n, axes=False) else: plot = circle((0,0),1,thickness=3) plot.xmin(-1); plot.xmax(1); plot.ymin(-1); plot.ymax(1) plot.set_aspect_ratio(4.0/3.0) return encode_plot(plot)