Python matplotlib.cm.jet() Examples
The following are 30
code examples of matplotlib.cm.jet().
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
matplotlib.cm
, or try the search function
.
Example #1
Source File: visualise_att_maps_epoch.py From Attention-Gated-Networks with MIT License | 7 votes |
def plotNNFilter(units, figure_id, interp='bilinear', colormap=cm.jet, colormap_lim=None): plt.ion() filters = units.shape[2] n_columns = round(math.sqrt(filters)) n_rows = math.ceil(filters / n_columns) + 1 fig = plt.figure(figure_id, figsize=(n_rows*3,n_columns*3)) fig.clf() for i in range(filters): ax1 = plt.subplot(n_rows, n_columns, i+1) plt.imshow(units[:,:,i].T, interpolation=interp, cmap=colormap) plt.axis('on') ax1.set_xticklabels([]) ax1.set_yticklabels([]) plt.colorbar() if colormap_lim: plt.clim(colormap_lim[0],colormap_lim[1]) plt.subplots_adjust(wspace=0, hspace=0) plt.tight_layout() # Epochs
Example #2
Source File: test_frame.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 6 votes |
def test_kde_colors(self): _skip_if_no_scipy_gaussian_kde() from matplotlib import cm custom_colors = 'rgcby' df = DataFrame(rand(5, 5)) ax = df.plot.kde(color=custom_colors) self._check_colors(ax.get_lines(), linecolors=custom_colors) tm.close() ax = df.plot.kde(colormap='jet') rgba_colors = lmap(cm.jet, np.linspace(0, 1, len(df))) self._check_colors(ax.get_lines(), linecolors=rgba_colors) tm.close() ax = df.plot.kde(colormap=cm.jet) rgba_colors = lmap(cm.jet, np.linspace(0, 1, len(df))) self._check_colors(ax.get_lines(), linecolors=rgba_colors)
Example #3
Source File: visualise_fmaps.py From Attention-Gated-Networks with MIT License | 6 votes |
def plotNNFilter(units, figure_id, interp='bilinear', colormap=cm.jet, colormap_lim=None): plt.ion() filters = units.shape[2] n_columns = round(math.sqrt(filters)) n_rows = math.ceil(filters / n_columns) + 1 fig = plt.figure(figure_id, figsize=(n_rows*3,n_columns*3)) fig.clf() for i in range(filters): ax1 = plt.subplot(n_rows, n_columns, i+1) plt.imshow(units[:,:,i].T, interpolation=interp, cmap=colormap) plt.axis('on') ax1.set_xticklabels([]) ax1.set_yticklabels([]) plt.colorbar() if colormap_lim: plt.clim(colormap_lim[0],colormap_lim[1]) plt.subplots_adjust(wspace=0, hspace=0) plt.tight_layout() # Load options
Example #4
Source File: visualise_attention.py From Attention-Gated-Networks with MIT License | 6 votes |
def plotNNFilter(units, figure_id, interp='bilinear', colormap=cm.jet, colormap_lim=None, title=''): plt.ion() filters = units.shape[2] n_columns = round(math.sqrt(filters)) n_rows = math.ceil(filters / n_columns) + 1 fig = plt.figure(figure_id, figsize=(n_rows*3,n_columns*3)) fig.clf() for i in range(filters): ax1 = plt.subplot(n_rows, n_columns, i+1) plt.imshow(units[:,:,i].T, interpolation=interp, cmap=colormap) plt.axis('on') ax1.set_xticklabels([]) ax1.set_yticklabels([]) plt.colorbar() if colormap_lim: plt.clim(colormap_lim[0],colormap_lim[1]) plt.subplots_adjust(wspace=0, hspace=0) plt.tight_layout() plt.suptitle(title)
Example #5
Source File: visualise_attention.py From Attention-Gated-Networks with MIT License | 6 votes |
def plotNNFilterOverlay(input_im, units, figure_id, interp='bilinear', colormap=cm.jet, colormap_lim=None, title='', alpha=0.8): plt.ion() filters = units.shape[2] fig = plt.figure(figure_id, figsize=(5,5)) fig.clf() for i in range(filters): plt.imshow(input_im[:,:,0], interpolation=interp, cmap='gray') plt.imshow(units[:,:,i], interpolation=interp, cmap=colormap, alpha=alpha) plt.axis('off') plt.colorbar() plt.title(title, fontsize='small') if colormap_lim: plt.clim(colormap_lim[0],colormap_lim[1]) plt.subplots_adjust(wspace=0, hspace=0) plt.tight_layout() # plt.savefig('{}/{}.png'.format(dir_name,time.time())) ## Load options
Example #6
Source File: test_frame.py From vnpy_crypto with MIT License | 6 votes |
def test_bar_colors(self): import matplotlib.pyplot as plt default_colors = self._maybe_unpack_cycler(plt.rcParams) df = DataFrame(randn(5, 5)) ax = df.plot.bar() self._check_colors(ax.patches[::5], facecolors=default_colors[:5]) tm.close() custom_colors = 'rgcby' ax = df.plot.bar(color=custom_colors) self._check_colors(ax.patches[::5], facecolors=custom_colors) tm.close() from matplotlib import cm # Test str -> colormap functionality ax = df.plot.bar(colormap='jet') rgba_colors = lmap(cm.jet, np.linspace(0, 1, 5)) self._check_colors(ax.patches[::5], facecolors=rgba_colors) tm.close() # Test colormap functionality ax = df.plot.bar(colormap=cm.jet) rgba_colors = lmap(cm.jet, np.linspace(0, 1, 5)) self._check_colors(ax.patches[::5], facecolors=rgba_colors) tm.close() ax = df.loc[:, [0]].plot.bar(color='DodgerBlue') self._check_colors([ax.patches[0]], facecolors=['DodgerBlue']) tm.close() ax = df.plot(kind='bar', color='green') self._check_colors(ax.patches[::5], facecolors=['green'] * 5) tm.close()
Example #7
Source File: gaussian_contours.py From QuantEcon.lectures.code with BSD 3-Clause "New" or "Revised" License | 6 votes |
def plot4(): # Density 1 Z = gen_gaussian_plot_vals(x_hat, Σ) cs1 = ax.contour(X, Y, Z, 6, colors="black") ax.clabel(cs1, inline=1, fontsize=10) # Density 2 M = Σ * G.T * linalg.inv(G * Σ * G.T + R) x_hat_F = x_hat + M * (y - G * x_hat) Σ_F = Σ - M * G * Σ Z_F = gen_gaussian_plot_vals(x_hat_F, Σ_F) cs2 = ax.contour(X, Y, Z_F, 6, colors="black") ax.clabel(cs2, inline=1, fontsize=10) # Density 3 new_x_hat = A * x_hat_F new_Σ = A * Σ_F * A.T + Q new_Z = gen_gaussian_plot_vals(new_x_hat, new_Σ) cs3 = ax.contour(X, Y, new_Z, 6, colors="black") ax.clabel(cs3, inline=1, fontsize=10) ax.contourf(X, Y, new_Z, 6, alpha=0.6, cmap=cm.jet) ax.text(float(y[0]), float(y[1]), r"$y$", fontsize=20, color="black") # == Choose a plot to generate == #
Example #8
Source File: test_frame.py From vnpy_crypto with MIT License | 6 votes |
def test_kde_colors(self): _skip_if_no_scipy_gaussian_kde() if not self.mpl_ge_1_5_0: pytest.skip("mpl is not supported") from matplotlib import cm custom_colors = 'rgcby' df = DataFrame(rand(5, 5)) ax = df.plot.kde(color=custom_colors) self._check_colors(ax.get_lines(), linecolors=custom_colors) tm.close() ax = df.plot.kde(colormap='jet') rgba_colors = lmap(cm.jet, np.linspace(0, 1, len(df))) self._check_colors(ax.get_lines(), linecolors=rgba_colors) tm.close() ax = df.plot.kde(colormap=cm.jet) rgba_colors = lmap(cm.jet, np.linspace(0, 1, len(df))) self._check_colors(ax.get_lines(), linecolors=rgba_colors)
Example #9
Source File: emitt_spread.py From ocelot with GNU General Public License v3.0 | 6 votes |
def plot3D_data(data, x, y): X,Y = meshgrid(x,y) fig = plt.figure() ax = Axes3D(fig) #ax = fig.add_subplot(111, projection = "3d") ax.plot_surface(X, Y, data, rstride=1, cstride=1, cmap=cm.jet) #def conditions_emitt_spread(screen): # if screen.ne ==1 and (screen.nx and screen.ny): # effect = 1 # elif screen.ne ==1 and (screen.nx==1 and screen.ny): # effect = 2 # elif screen.ne ==1 and (screen.nx and screen.ny == 1): # effect = 3 # elif screen.ne >1 and (screen.nx == 1 and screen.ny == 1): # effect = 4 # else: # effect = 0 # return effect
Example #10
Source File: sgd.py From tf-matplotlib with MIT License | 6 votes |
def init_fig(*args, **kwargs): '''Initialize figures.''' fig = tfmpl.create_figure(figsize=(8,6)) ax = fig.add_subplot(111, projection='3d', elev=50, azim=-30) ax.w_xaxis.set_pane_color((1.0,1.0,1.0,1.0)) ax.w_yaxis.set_pane_color((1.0,1.0,1.0,1.0)) ax.w_zaxis.set_pane_color((1.0,1.0,1.0,1.0)) ax.set_title('Gradient descent on Beale surface') ax.set_xlabel('$x$') ax.set_ylabel('$y$') ax.set_zlabel('beale($x$,$y$)') xx, yy = np.meshgrid(np.linspace(-4.5, 4.5, 40), np.linspace(-4.5, 4.5, 40)) zz = beale(xx, yy) ax.plot_surface(xx, yy, zz, norm=LogNorm(), rstride=1, cstride=1, edgecolor='none', alpha=.8, cmap=cm.jet) ax.plot([3], [.5], [beale(3, .5)], 'k*', markersize=5) for o in optimizers: path, = ax.plot([],[],[], label=o[1]) paths.append(path) ax.legend(loc='upper left') fig.tight_layout() return fig, paths
Example #11
Source File: test_frame.py From recruit with Apache License 2.0 | 6 votes |
def test_kde_colors(self): _skip_if_no_scipy_gaussian_kde() from matplotlib import cm custom_colors = 'rgcby' df = DataFrame(rand(5, 5)) ax = df.plot.kde(color=custom_colors) self._check_colors(ax.get_lines(), linecolors=custom_colors) tm.close() ax = df.plot.kde(colormap='jet') rgba_colors = lmap(cm.jet, np.linspace(0, 1, len(df))) self._check_colors(ax.get_lines(), linecolors=rgba_colors) tm.close() ax = df.plot.kde(colormap=cm.jet) rgba_colors = lmap(cm.jet, np.linspace(0, 1, len(df))) self._check_colors(ax.get_lines(), linecolors=rgba_colors)
Example #12
Source File: logos2.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 6 votes |
def add_polar_bar(): ax = fig.add_axes([0.025, 0.075, 0.2, 0.85], projection='polar') ax.patch.set_alpha(axalpha) ax.set_axisbelow(True) N = 7 arc = 2. * np.pi theta = np.arange(0.0, arc, arc/N) radii = 10 * np.array([0.2, 0.6, 0.8, 0.7, 0.4, 0.5, 0.8]) width = np.pi / 4 * np.array([0.4, 0.4, 0.6, 0.8, 0.2, 0.5, 0.3]) bars = ax.bar(theta, radii, width=width, bottom=0.0) for r, bar in zip(radii, bars): bar.set_facecolor(cm.jet(r/10.)) bar.set_alpha(0.6) ax.tick_params(labelbottom=False, labeltop=False, labelleft=False, labelright=False) ax.grid(lw=0.8, alpha=0.9, ls='-', color='0.5') ax.set_yticks(np.arange(1, 9, 2)) ax.set_rmax(9)
Example #13
Source File: test.py From Context-Aware_Crowd_Counting-pytorch with MIT License | 6 votes |
def estimate_density_map(img_root,gt_dmap_root,model_param_path,index): ''' Show one estimated density-map. img_root: the root of test image data. gt_dmap_root: the root of test ground truth density-map data. model_param_path: the path of specific mcnn parameters. index: the order of the test image in test dataset. ''' device=torch.device("cuda") model=CANNet().to(device) model.load_state_dict(torch.load(model_param_path)) dataset=CrowdDataset(img_root,gt_dmap_root,8,phase='test') dataloader=torch.utils.data.DataLoader(dataset,batch_size=1,shuffle=False) model.eval() for i,(img,gt_dmap) in enumerate(dataloader): if i==index: img=img.to(device) gt_dmap=gt_dmap.to(device) # forward propagation et_dmap=model(img).detach() et_dmap=et_dmap.squeeze(0).squeeze(0).cpu().numpy() print(et_dmap.shape) plt.imshow(et_dmap,cmap=CM.jet) break
Example #14
Source File: plot.py From psst with MIT License | 6 votes |
def plot_stacked_power_generation(results, ax=None, kind='bar', legend=False): if ax is None: fig, axs = plt.subplots(1, 1, figsize=(16, 10)) ax = axs df = results.power_generated cols = (df - results.unit_commitment*results.maximum_power_output).std().sort_values().index df = df[[c for c in cols]] df.plot(kind=kind, stacked=True, ax=ax, colormap=cm.jet, alpha=0.5, legend=legend) df = results.unit_commitment * results.maximum_power_output df = df[[c for c in cols]] df.plot.area(stacked=True, ax=ax, alpha=0.125/2, colormap=cm.jet, legend=None) ax.set_ylabel('Dispatch and Committed Capacity (MW)') ax.set_xlabel('Time (h)') return ax
Example #15
Source File: fig09_val_maxima.py From spm1d with GNU General Public License v3.0 | 5 votes |
def scalar2color(x, cmap=cm.jet, xmin=None, xmax=None): x = np.asarray(x, dtype=float) if xmin is None: xmin = x.min() if xmax is None: xmax = x.max() xn = (x - xmin) / (xmax-xmin) xn *= 255 xn = np.asarray(xn, dtype=int) colors = cmap(xn) return colors ### EPS production preliminaries:
Example #16
Source File: visualize.py From landmark-detection with MIT License | 5 votes |
def jet(m): cm_subsection = linspace(0, 1, m) colors = [ cm.jet(x) for x in cm_subsection ] J = np.array(colors) J = J[:, :3] return J
Example #17
Source File: visualization.py From scanobjectnn with MIT License | 5 votes |
def draw_gaussian_points(points, g_points, gmm, idx=1, ax=None, display=False, color_val = 0, title=None, vmin=-1,vmax=1, colormap_type='jet'): if g_points.size==0: print('No points in this gaussian forthe given threshold...') return None if ax==None: fig = plt.figure() ax = fig.add_subplot(111, projection='3d') ax = set_ax_props(ax) if title is not None: ax.set_title(title) x, y, z = sphere() n_gaussians = len(gmm.weights_) X = x*np.sqrt(gmm.covariances_[idx][0]) + gmm.means_[idx][0] Y = y*np.sqrt(gmm.covariances_[idx][1]) + gmm.means_[idx][1] Z = z*np.sqrt(gmm.covariances_[idx][2]) + gmm.means_[idx][2] ax.plot_surface(X, Y, Z, alpha=0.4, linewidth=1) cmap = cm.ScalarMappable() cmap.set_cmap(colormap_type) cmap.set_clim(vmin, vmax) c = cmap.to_rgba(color_val) #ax = draw_point_cloud(points, ax=ax) ax = draw_point_cloud(g_points, points, ax=ax, color=c, vmin=vmin, vmax=vmax) if display: plt.show() return ax
Example #18
Source File: fig07_bonf_sf.py From spm1d with GNU General Public License v3.0 | 5 votes |
def scalar2color(x, cmap=cm.jet, xmin=None, xmax=None): x = np.asarray(x, dtype=float) if xmin is None: xmin = x.min() if xmax is None: xmax = x.max() xn = (x - xmin) / (xmax-xmin) xn *= 255 xn = np.asarray(xn, dtype=int) colors = cmap(xn) return colors ### EPS production preliminaries:
Example #19
Source File: fig04_fields1d_broken.py From spm1d with GNU General Public License v3.0 | 5 votes |
def scalar2color(x, cmap=cm.jet, xmin=None, xmax=None): x = np.asarray(x, dtype=float) if xmin is None: xmin = x.min() if xmax is None: xmax = x.max() xn = (x - xmin) / (xmax-xmin) xn *= 255 xn = np.asarray(xn, dtype=int) colors = cmap(xn) return colors ### EPS production preliminaries:
Example #20
Source File: fig01_fields1d.py From spm1d with GNU General Public License v3.0 | 5 votes |
def scalar2color(x, cmap=cm.jet, xmin=None, xmax=None): x = np.asarray(x, dtype=float) if xmin is None: xmin = x.min() if xmax is None: xmax = x.max() xn = (x - xmin) / (xmax-xmin) xn *= 255 xn = np.asarray(xn, dtype=int) colors = cmap(xn) return colors ### EPS production preliminaries:
Example #21
Source File: visualize2D.py From Gated2Depth with MIT License | 5 votes |
def colorize_pointcloud(depth, min_distance=3, max_distance=80, radius=3): norm = mpl.colors.Normalize(vmin=min_distance, vmax=max_distance) cmap = cm.jet m = cm.ScalarMappable(norm=norm, cmap=cmap) pos = np.argwhere(depth > 0) pointcloud_color = np.zeros((depth.shape[0], depth.shape[1], 3), dtype=np.uint8) for i in range(pos.shape[0]): color = tuple([int(255 * value) for value in m.to_rgba(depth[pos[i, 0], pos[i, 1]])[0:3]]) cv2.circle(pointcloud_color, (pos[i, 1], pos[i, 0]), radius, (color[0], color[1], color[2]), -1) return pointcloud_color
Example #22
Source File: test_frame.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
def test_bar_colors(self): import matplotlib.pyplot as plt default_colors = self._unpack_cycler(plt.rcParams) df = DataFrame(randn(5, 5)) ax = df.plot.bar() self._check_colors(ax.patches[::5], facecolors=default_colors[:5]) tm.close() custom_colors = 'rgcby' ax = df.plot.bar(color=custom_colors) self._check_colors(ax.patches[::5], facecolors=custom_colors) tm.close() from matplotlib import cm # Test str -> colormap functionality ax = df.plot.bar(colormap='jet') rgba_colors = lmap(cm.jet, np.linspace(0, 1, 5)) self._check_colors(ax.patches[::5], facecolors=rgba_colors) tm.close() # Test colormap functionality ax = df.plot.bar(colormap=cm.jet) rgba_colors = lmap(cm.jet, np.linspace(0, 1, 5)) self._check_colors(ax.patches[::5], facecolors=rgba_colors) tm.close() ax = df.loc[:, [0]].plot.bar(color='DodgerBlue') self._check_colors([ax.patches[0]], facecolors=['DodgerBlue']) tm.close() ax = df.plot(kind='bar', color='green') self._check_colors(ax.patches[::5], facecolors=['green'] * 5) tm.close()
Example #23
Source File: test_misc.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
def test_radviz(self, iris): from pandas.plotting import radviz from matplotlib import cm df = iris _check_plot_works(radviz, frame=df, class_column='Name') rgba = ('#556270', '#4ECDC4', '#C7F464') ax = _check_plot_works( radviz, frame=df, class_column='Name', color=rgba) # skip Circle drawn as ticks patches = [p for p in ax.patches[:20] if p.get_label() != ''] self._check_colors( patches[:10], facecolors=rgba, mapping=df['Name'][:10]) cnames = ['dodgerblue', 'aquamarine', 'seagreen'] _check_plot_works(radviz, frame=df, class_column='Name', color=cnames) patches = [p for p in ax.patches[:20] if p.get_label() != ''] self._check_colors(patches, facecolors=cnames, mapping=df['Name'][:10]) _check_plot_works(radviz, frame=df, class_column='Name', colormap=cm.jet) cmaps = lmap(cm.jet, np.linspace(0, 1, df['Name'].nunique())) patches = [p for p in ax.patches[:20] if p.get_label() != ''] self._check_colors(patches, facecolors=cmaps, mapping=df['Name'][:10]) colors = [[0., 0., 1., 1.], [0., 0.5, 1., 1.], [1., 0., 0., 1.]] df = DataFrame({"A": [1, 2, 3], "B": [2, 1, 3], "C": [3, 2, 1], "Name": ['b', 'g', 'r']}) ax = radviz(df, 'Name', color=colors) handles, labels = ax.get_legend_handles_labels() self._check_colors(handles, facecolors=colors)
Example #24
Source File: vis_tools.py From USIP with GNU General Public License v3.0 | 5 votes |
def plot_pc(pc_np, z_cutoff=1000, birds_view=False, color='height', size=0.3, ax=None, cmap=cm.jet, is_equal_axes=True): # remove large z points valid_index = pc_np[:, 0] < z_cutoff pc_np = pc_np[valid_index, :] if ax is None: fig = plt.figure(figsize=(9, 9)) ax = Axes3D(fig) if type(color)==str and color == 'height': c = pc_np[:, 2] ax.scatter(pc_np[:, 0], pc_np[:, 1], pc_np[:, 2], s=size, c=c, cmap=cmap, edgecolors='none') elif type(color)==str and color == 'reflectance': assert False elif type(color) == np.ndarray: ax.scatter(pc_np[:, 0], pc_np[:, 1], pc_np[:, 2], s=size, c=color, cmap=cmap, edgecolors='none') else: ax.scatter(pc_np[:, 0], pc_np[:, 1], pc_np[:, 2], s=size, c=color, edgecolors='none') if is_equal_axes: axisEqual3D(ax) if True == birds_view: ax.view_init(elev=0, azim=-90) else: ax.view_init(elev=-45, azim=-90) # ax.invert_yaxis() return ax
Example #25
Source File: base.py From blueoil with Apache License 2.0 | 5 votes |
def _heatmaps(self, target_feature_map): """Generate heatmap from target feature map. Args: target_feature_map (Tensor): Tensor to be generate heatmap. shape is [batch_size, h, w, num_classes]. """ assert target_feature_map.get_shape()[3].value == self.num_classes results = [] # shape: [batch_size, height, width, num_classes] heatmap = tf.image.resize( target_feature_map, [self.image_size[0], self.image_size[1]], method=tf.image.ResizeMethod.BICUBIC, ) epsilon = 1e-10 # standrization. all element are in the interval [0, 1]. heatmap = (heatmap - tf.reduce_min(heatmap)) / (tf.reduce_max(heatmap) - tf.reduce_min(heatmap) + epsilon) for i, class_name in enumerate(self.classes): class_heatmap = heatmap[:, :, :, i] indices = tf.cast(tf.round(class_heatmap * 255), tf.int32) color_map = cm.jet # Init color map for useing color lookup table(_lut). color_map._init() colors = tf.constant(color_map._lut[:, :3], dtype=tf.float32) # gather colored_class_heatmap = tf.gather(colors, indices) results.append(colored_class_heatmap) return results
Example #26
Source File: pyplot.py From neural-network-animation with MIT License | 5 votes |
def jet(): ''' set the default colormap to jet and apply to current image if any. See help(colormaps) for more information ''' rc('image', cmap='jet') im = gci() if im is not None: im.set_cmap(cm.jet) draw_if_interactive() # This function was autogenerated by boilerplate.py. Do not edit as # changes will be lost
Example #27
Source File: pyplot.py From neural-network-animation with MIT License | 5 votes |
def sci(im): """ Set the current image. This image will be the target of colormap commands like :func:`~matplotlib.pyplot.jet`, :func:`~matplotlib.pyplot.hot` or :func:`~matplotlib.pyplot.clim`). The current image is an attribute of the current axes. """ gca()._sci(im) ## Any Artist ## # (getp is simply imported)
Example #28
Source File: collections.py From neural-network-animation with MIT License | 5 votes |
def __init__(self, numsides, rotation=0, sizes=(1,), **kwargs): """ *numsides* the number of sides of the polygon *rotation* the rotation of the polygon in radians *sizes* gives the area of the circle circumscribing the regular polygon in points^2 %(Collection)s Example: see :file:`examples/dynamic_collection.py` for complete example:: offsets = np.random.rand(20,2) facecolors = [cm.jet(x) for x in np.random.rand(20)] black = (0,0,0,1) collection = RegularPolyCollection( numsides=5, # a pentagon rotation=0, sizes=(50,), facecolors = facecolors, edgecolors = (black,), linewidths = (1,), offsets = offsets, transOffset = ax.transData, ) """ Collection.__init__(self, **kwargs) self.set_sizes(sizes) self._numsides = numsides self._paths = [self._path_generator(numsides)] self._rotation = rotation self.set_transform(transforms.IdentityTransform())
Example #29
Source File: gaussian_contours.py From QuantEcon.lectures.code with BSD 3-Clause "New" or "Revised" License | 5 votes |
def plot3(): Z = gen_gaussian_plot_vals(x_hat, Σ) cs1 = ax.contour(X, Y, Z, 6, colors="black") ax.clabel(cs1, inline=1, fontsize=10) M = Σ * G.T * linalg.inv(G * Σ * G.T + R) x_hat_F = x_hat + M * (y - G * x_hat) Σ_F = Σ - M * G * Σ new_Z = gen_gaussian_plot_vals(x_hat_F, Σ_F) cs2 = ax.contour(X, Y, new_Z, 6, colors="black") ax.clabel(cs2, inline=1, fontsize=10) ax.contourf(X, Y, new_Z, 6, alpha=0.6, cmap=cm.jet) ax.text(float(y[0]), float(y[1]), r"$y$", fontsize=20, color="black")
Example #30
Source File: gaussian_contours.py From QuantEcon.lectures.code with BSD 3-Clause "New" or "Revised" License | 5 votes |
def plot2(): Z = gen_gaussian_plot_vals(x_hat, Σ) ax.contourf(X, Y, Z, 6, alpha=0.6, cmap=cm.jet) cs = ax.contour(X, Y, Z, 6, colors="black") ax.clabel(cs, inline=1, fontsize=10) ax.text(float(y[0]), float(y[1]), r"$y$", fontsize=20, color="black")