def plot_embedding(self, title='', edges=False, colors=None, labels=None, axis=True, plot=True, ax=None, **kwargs): assert self.dim >= 2 if ax is None: fig, ax = plt.subplots() else: plot = False if edges is True: edges = self.D['edge_list'] elif edges is False: edges = None if colors is True: colors = self.sample_colors plots.plot2D(self.embedding, edges=edges, colors=colors, labels=labels, axis=axis, ax=ax, title=title, **kwargs) if plot is True: plt.draw() plt.pause(1)
def plot_images(self,title=None,edges=False, colors=True,plot=True, ax=None,**kwargs): if ax is None: fig, ax = plt.subplots(1,self.n_perspectives, figsize=(3*self.n_perspectives,3)) else: plot = False if edges is False: edges = [None]*self.n_perspectives elif edges is True: edges = [] for k in range(self.n_perspectives): edges.append(self.distances[k]['edge_list']) else: edges = edges for k in range(self.n_perspectives): if colors is True: colors_k = [0]+list(self.distances[k][0:self.n_samples-1]) #### elif colors is False: colors_k = None else: colors_k = colors plots.plot2D(self.images[k],edges=edges[k],colors=colors_k,ax=ax[k], **kwargs) plt.suptitle(title) if plot is True: plt.draw() plt.pause(1.0)
def figureY(self, title='perspectives', edges=False, colors=True, plot=True, ax=None, **kwargs): if ax is None: fig, ax = plt.subplots(1, self.K) else: plot = False for k in range(self.K): if edges is True: edges_k = self.D[k]['edges'] elif edges is False: edges_k = None else: edges_k = edges[k] if colors is True: colors_k = self.D[k]['colors'] else: colors_k = None plots.plot2D(self.Y[k], edges=edges_k, colors=colors_k, ax=ax[k], **kwargs) plt.suptitle(title) if plot is True: plt.draw() plt.pause(1.0)
def plot(self): plot2D(self) date = self.date_combo_box.currentText() begin = datetime.strptime(date, "%Y-%m-%d %H:%M:%S") city_by_hour_prediction = [ (city.city_id, city.forecast.get_forecast(begin - timedelta(minutes=1), begin + timedelta(minutes=1))) for city in self.cities ] self.map_widget.render_3d_map( city_by_hour_prediction, { 'temp': self.temperature_check_box.isChecked(), 'pres': self.pressure_check_box.isChecked(), 'clouds': self.clouds_check_box.isChecked(), 'pre': self.precipitation_check_box.isChecked(), 'wind': self.wind_check_box.isChecked() })
def plot_image(self,index,title='embedding',edges=False,colors='default', labels=None, axis=True,plot=True, ax=None,**kwargs): assert self.image_dimension >= 2 if edges is True: edges = self.distances['edge_list'] elif edges is False: edges = None if colors == 'default': colors = self.sample_colors if self.image_dimension == 2: plots.plot2D(self.images[index],edges=edges,colors=colors, labels=labels, axis=axis,ax=ax,title=title,**kwargs) else: plots.plot3D(self.X,edges=edges,colors=colors,title=title, ax=ax,**kwargs) if plot is True: plt.draw() plt.pause(1)
def plot_images(self,title=None,edges=None, colors=True,plot=True, ax=None,**kwargs): if ax is None: fig, ax = plt.subplots(1,self.n_perspectives, figsize=(3*self.n_perspectives,3)) else: plot = False if edges is None: edges = [None]*self.n_perspectives else: edges = edges #setup colors if colors is True: colors = self.image_colors if colors is None: colors = self.sample_colors for k in range(self.n_perspectives): if isinstance(colors,list) and len(colors)==self.n_perspectives: colors_k = colors[k] else: colors_k = colors if isinstance(colors_k, int): assert colors_k in range(self.n_samples) colors_k = scipy.spatial.distance.squareform(self.distances[k])[colors_k] plots.plot2D(self.images[k],edges=edges[k],colors=colors_k,ax=ax[k], weight=self.weights[k], **kwargs) #ax[k].set_xlabel('individual cost:'+ f'{self.individual_cost[k]}') plt.suptitle(title) if plot is True: plt.draw() return fig