def _view_poi_histogram(self, event): current_cluster = self.current_cluster() if not current_cluster.points_of_interest: plt.figure() plt.figtext(0.1, 0.1, 'Sorry, no points of interest for this cluster. Try running explorer again with -poi poi_dataset.bed') plt.show() return # Pandas tend to crash if subplots is True when only one dimension number_poi_collections = len(current_cluster.points_of_interest_histogram.columns) axes = current_cluster.points_of_interest_histogram.plot(kind='bar', subplots=(number_poi_collections > 1)) if number_poi_collections == 1: axes = [axes] for ax in axes: ax.set_ylabel('Number of regions') plt.xlabel('Bin') plt.suptitle('Original points of interest') axes = current_cluster.tracked_points_histogram.plot(kind='bar', subplots=(number_poi_collections > 1)) if number_poi_collections == 1: axes = [axes] for ax in axes: ax.set_ylabel('Number of regions') plt.xlabel('Warped bin') plt.suptitle('Warped points of interest') plt.show()
def plot_heatmap(dataset): """ Plots heatmap of dataset with POIs superimposed on it :param dataset: :return: """ dataset.plot_heatmap(highlighted_points=dataset.points_of_interest, sort_by=None) plt.show()
def _onclick_listener(self, event): if not self.ax_heatmap().contains(event)[0] and not self.ax_projected_heatmap().contains(event)[0]: if (self._enlarged_heatmap_axis is None or not self._enlarged_heatmap_axis.contains(event)[0]) and \ (self._enlarged_projected_heatmap_axis is None or not self._enlarged_projected_heatmap_axis.contains(event)[0]): return if event.ydata is None or event.button != 3: return ylabel = event.inaxes.yaxis.get_major_formatter()(event.ydata) try: self._plot_item_in_figure(ylabel) plt.show() except Exception, e: error('Something went wrong when plotting {0!r}, got: {1!r}'.format(ylabel, e)) raise
def show(self): self.create_figure(interactive=True) self.draw() plt.show()
def _enlarge_heatmaps(self, event): self._plot_regular_heatmap_on_figure(self.current_cluster()) plt.show() self._plot_projected_heatmap_on_figure(self.current_cluster()) plt.show()