当前位置: 首页>>代码示例>>Python>>正文


Python pyplot.get_current_fig_manager方法代码示例

本文整理汇总了Python中matplotlib.pyplot.get_current_fig_manager方法的典型用法代码示例。如果您正苦于以下问题:Python pyplot.get_current_fig_manager方法的具体用法?Python pyplot.get_current_fig_manager怎么用?Python pyplot.get_current_fig_manager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.pyplot的用法示例。


在下文中一共展示了pyplot.get_current_fig_manager方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_root_locus_zoom

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import get_current_fig_manager [as 别名]
def test_root_locus_zoom(self):
        """Check the zooming functionality of the Root locus plot"""
        system = TransferFunction([1000], [1, 25, 100, 0])
        root_locus(system)
        fig = plt.gcf()
        ax_rlocus = fig.axes[0]

        event = type('test', (object,), {'xdata': 14.7607954359, 'ydata': -35.6171379864, 'inaxes': ax_rlocus.axes})()
        ax_rlocus.set_xlim((-10.813628105112421, 14.760795435937652))
        ax_rlocus.set_ylim((-35.61713798641108, 33.879716621220311))
        plt.get_current_fig_manager().toolbar.mode = 'zoom rect'
        _RLClickDispatcher(event, system, fig, ax_rlocus, '-')

        zoom_x = ax_rlocus.lines[-2].get_data()[0][0:5]
        zoom_y = ax_rlocus.lines[-2].get_data()[1][0:5]
        zoom_y = [abs(y) for y in zoom_y]

        zoom_x_valid = [-5. ,- 4.61281263, - 4.16689986, - 4.04122642, - 3.90736502]
        zoom_y_valid = [0. ,0., 0., 0., 0.]

        assert_array_almost_equal(zoom_x,zoom_x_valid)
        assert_array_almost_equal(zoom_y,zoom_y_valid) 
开发者ID:python-control,项目名称:python-control,代码行数:24,代码来源:rlocus_test.py

示例2: _RLClickDispatcher

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import get_current_fig_manager [as 别名]
def _RLClickDispatcher(event, sys, fig, ax_rlocus, plotstr, sisotool=False,
                       bode_plot_params=None, tvect=None):
    """Rootlocus plot click dispatcher"""

    # Zoom is handled by specialized callback above, only do gain plot
    if event.inaxes == ax_rlocus.axes and \
       plt.get_current_fig_manager().toolbar.mode not in \
       {'zoom rect', 'pan/zoom'}:

        # if a point is clicked on the rootlocus plot visually emphasize it
        K = _RLFeedbackClicksPoint(event, sys, fig, ax_rlocus, sisotool)
        if sisotool and K is not None:
            _SisotoolUpdate(sys, fig, K, bode_plot_params, tvect)

    # Update the canvas
    fig.canvas.draw() 
开发者ID:python-control,项目名称:python-control,代码行数:18,代码来源:rlocus.py

示例3: main

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import get_current_fig_manager [as 别名]
def main(args):
    """
    Main function for the script
    :param args: parsed command line arguments
    :return: None
    """

    img_file = os.path.join(args.image_path)
    if args.npz_file:
        img = np.load(img_file)
        img = img.squeeze(0).transpose(1, 2, 0)
    else:
        img = np.array(Image.open(img_file))

    # show the image on screen:
    plt.figure().suptitle(args.image_path.split("/")[-1])
    plt.imshow(img)
    mng = plt.get_current_fig_manager()
    mng.resize(*mng.window.maxsize())
    plt.show() 
开发者ID:akanimax,项目名称:BMSG-GAN,代码行数:22,代码来源:show_single_image.py

示例4: main

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import get_current_fig_manager [as 别名]
def main(args):
    """
    Main function for the script
    :param args: parsed command line arguments
    :return: None
    """
    # go over the image files in the directory
    for img_file_name in os.listdir(args.images_path):

        img_file = os.path.join(args.images_path, img_file_name)
        if args.npz_files:
            img = np.load(img_file)
            img = img.squeeze(0).transpose(1, 2, 0)
        else:
            img = np.array(Image.open(img_file))

        # show the image on screen:
        plt.figure().suptitle(img_file_name)
        plt.imshow(img)
        mng = plt.get_current_fig_manager()
        mng.resize(*mng.window.maxsize())
        plt.show() 
开发者ID:akanimax,项目名称:BMSG-GAN,代码行数:24,代码来源:show_real_images.py

示例5: visualize_stn

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import get_current_fig_manager [as 别名]
def visualize_stn(data, title):
    input_tensor = data.cpu()
    input_tensor = torch.squeeze(input_tensor)
    input_tensor = input_tensor.detach().numpy()
    N = len(input_tensor)

    fig=plt.figure(num = 2)

    columns = N
    rows = 1
    for i in range(1, columns*rows +1):
        img = input_tensor[i-1]
        fig.add_subplot(rows, columns, i)
        plt.imshow(img, cmap='gray', interpolation='none')

    figManager = plt.get_current_fig_manager()
    figManager.resize(*figManager.window.maxsize())
    # figManager.window.state('zoomed')
    plt.show(block=False)
    # time.sleep(4)
    # plt.close() 
开发者ID:anshulpaigwar,项目名称:Attentional-PointNet,代码行数:23,代码来源:utils.py

示例6: show

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import get_current_fig_manager [as 别名]
def show(self, plot_config, block=True, maximize=False, window_title=None):
        """Show the data contained in this visualizer using the specifics in this function call.

        Args:
            plot_config (mdt.visualization.maps.base.MapPlotConfig): the plot configuration
            block (boolean): If we want to block after calling the plots or not. Set this to False if you
                do not want the routine to block after drawing. In doing so you manually need to block.
            maximize (boolean): if we want to display the window maximized or not
            window_title (str): the title of the window. If None, the default title is used
        """
        Renderer(self._data_info, self._figure, plot_config).render()

        if maximize:
            mng = plt.get_current_fig_manager()
            mng.window.showMaximized()

        if window_title:
            mng = plt.get_current_fig_manager()
            mng.canvas.set_window_title(window_title)

        if block:
            plt.show(True) 
开发者ID:robbert-harms,项目名称:MDT,代码行数:24,代码来源:matplotlib_renderer.py

示例7: show_pca

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import get_current_fig_manager [as 别名]
def show_pca(self, dest_image, updater):
        colors = ['navy', 'turquoise', 'darkorange']
        if getattr(updater, 'pca', None) is None:
            return dest_image
        pca_discriminator = updater.pca.reshape(3, -1, updater.n_components_pca)

        plt.figure()
        for i, color, in enumerate(colors):
            plt.scatter(pca_discriminator[i, :, 0], pca_discriminator[i, :, 1], color=color, lw=2)
        plt.legend(['fake', 'real', 'anchor'])

        canvas = plt.get_current_fig_manager().canvas
        canvas.draw()
        image = Image.frombytes('RGB', canvas.get_width_height(), canvas.tostring_rgb())
        image = image.resize((self.image_size.width, self.image_size.height), Image.LANCZOS)
        dest_image.paste(image, (self.image_size.width, self.image_size.height))
        plt.close()
        return dest_image 
开发者ID:Bartzi,项目名称:kiss,代码行数:20,代码来源:bbox_plotter.py

示例8: show

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import get_current_fig_manager [as 别名]
def show(pts, cells, geo, title=None, full_screen=True):
    import matplotlib.pyplot as plt

    eps = 1.0e-10
    is_inside = geo.dist(pts.T) < eps
    plt.plot(pts[is_inside, 0], pts[is_inside, 1], ".")
    plt.plot(pts[~is_inside, 0], pts[~is_inside, 1], ".", color="r")
    plt.triplot(pts[:, 0], pts[:, 1], cells)
    plt.axis("square")

    if full_screen:
        figManager = plt.get_current_fig_manager()
        try:
            figManager.window.showMaximized()
        except AttributeError:
            # Some backends have no window (e.g., Agg)
            pass

    if title is not None:
        plt.title(title)

    try:
        geo.show(level_set=False)
    except AttributeError:
        pass 
开发者ID:nschloe,项目名称:dmsh,代码行数:27,代码来源:helpers.py

示例9: export_all_contours

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import get_current_fig_manager [as 别名]
def export_all_contours(contours, img_path):
    counter_img = 0
    counter_label = 0
    batchsz = 100
    print("Processing {:d} images and labels...".format(len(contours)))
    for i, ctr in enumerate(contours):
        img, label = load_contour(ctr, img_path)
        images.append(img)
        labels.append(label)
        #print ctr
        #if "SC-HYP-12" in ctr.__str__():
            #pass
        """
        if i>-1:
            plt.figure()
            mngr = plt.get_current_fig_manager()
            # to put it into the upper left corner for example:
            mngr.window.setGeometry(50, 100, 640, 545)
            plt.suptitle(ctr.__str__() + "  #%d" % i)
            plt.imshow(img * (1-label) + (np.max(img)-img)*(label) )
            #plt.imshow(label)
            plt.show()
            """ 
开发者ID:317070,项目名称:kaggle-heart,代码行数:25,代码来源:sunny2npy.py

示例10: animate_slice

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import get_current_fig_manager [as 别名]
def animate_slice(slicedata1, slicedata2, index1, index2):
    fig, (ax1, ax2) = plt.subplots(1, 2)
    mngr = plt.get_current_fig_manager()
    # to put it into the upper left corner for example:
    mngr.window.setGeometry(50, 100, 600, 300)

    im1 = ax1.imshow(slicedata1[0], cmap='gist_gray_r')
    im2 = ax2.imshow(slicedata2[0], cmap='gist_gray_r')

    fig.suptitle('patient %d vs %d' % (index1, index2))

    def init():
        im1.set_data(slicedata1[0])
        im2.set_data(slicedata2[0])

    def animate(i):
        im1.set_data(slicedata1[i])
        im2.set_data(slicedata2[i])
        return im1

    anim = animation.FuncAnimation(fig, animate, init_func=init, frames=len(slicedata1), interval=50)

    plt.show() 
开发者ID:317070,项目名称:kaggle-heart,代码行数:25,代码来源:visualize_normscale_preprocessing.py

示例11: prepare

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import get_current_fig_manager [as 别名]
def prepare(self):
    if self.backend:
      plt.switch_backend(self.backend)
    self.f = plt.figure(figsize=self.window_size)
    self.ax = self.f.add_subplot(111)
    self.lines = []
    for _ in self.labels:
      if self.interp:
        self.lines.append(self.ax.plot([], [])[0])
      else:
        self.lines.append(self.ax.step([], [])[0])
    # Keep only 1/factor points on each line
    self.factor = [1 for i in self.labels]
    # Count to drop exactly 1/factor points, no more and no less
    self.counter = [0 for i in self.labels]
    legend = [y for x, y in self.labels]
    plt.legend(legend, bbox_to_anchor=(-0.03, 1.02, 1.06, .102), loc=3,
               ncol=len(legend), mode="expand", borderaxespad=1)
    plt.xlabel(self.labels[0][0])
    plt.ylabel(self.labels[0][1])
    plt.grid()
    self.axclear = plt.axes([.8,.02,.15,.05])
    self.bclear = Button(self.axclear,'Clear')
    self.bclear.on_clicked(self.clear)

    if self.window_pos:
      mng = plt.get_current_fig_manager()
      mng.window.wm_geometry("+%s+%s" % self.window_pos)
    plt.draw()
    plt.pause(.001) 
开发者ID:LaboratoireMecaniqueLille,项目名称:crappy,代码行数:32,代码来源:grapher.py

示例12: visualize

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import get_current_fig_manager [as 别名]
def visualize(data, fig_num, title):
    input_tensor = data.cpu()
    input_tensor = torch.squeeze(input_tensor)
    in_grid = input_tensor.detach().numpy()

    fig=plt.figure(num = fig_num)
    plt.imshow(in_grid, cmap='gray', interpolation='none')
    plt.title(title)
    figManager = plt.get_current_fig_manager()
    figManager.resize(*figManager.window.maxsize())
    plt.show(block=False)
    # time.sleep(4)
    # plt.close() 
开发者ID:anshulpaigwar,项目名称:Attentional-PointNet,代码行数:15,代码来源:utils.py

示例13: forSecond

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import get_current_fig_manager [as 别名]
def forSecond(frame_number, output_arrays, count_arrays, average_count, returned_frame):

    plt.clf()

    this_colors = []
    labels = []
    sizes = []

    counter = 0

    for eachItem in average_count:
        counter += 1
        labels.append(eachItem + " = " + str(average_count[eachItem]))
        sizes.append(average_count[eachItem])
        this_colors.append(color_index[eachItem])

    global resized

    if (resized == False):
        manager = plt.get_current_fig_manager()
        manager.resize(width=1000, height=500)
        resized = True

    plt.subplot(1, 2, 1)
    plt.title("Second : " + str(frame_number))
    plt.axis("off")
    plt.imshow(returned_frame, interpolation="none")

    plt.subplot(1, 2, 2)
    plt.title("Analysis: " + str(frame_number))
    plt.pie(sizes, labels=labels, colors=this_colors, shadow=True, startangle=140, autopct="%1.1f%%")

    plt.pause(0.01) 
开发者ID:OlafenwaMoses,项目名称:ImageAI,代码行数:35,代码来源:video_analysis_per_second.py

示例14: forFrame

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import get_current_fig_manager [as 别名]
def forFrame(frame_number, output_array, output_count, returned_frame):

    plt.clf()

    this_colors = []
    labels = []
    sizes = []

    counter = 0

    for eachItem in output_count:
        counter += 1
        labels.append(eachItem + " = " + str(output_count[eachItem]))
        sizes.append(output_count[eachItem])
        this_colors.append(color_index[eachItem])

    global resized

    if (resized == False):
        manager = plt.get_current_fig_manager()
        manager.resize(width=1000, height=500)
        resized = True

    plt.subplot(1, 2, 1)
    plt.title("Frame : " + str(frame_number))
    plt.axis("off")
    plt.imshow(returned_frame, interpolation="none")

    plt.subplot(1, 2, 2)
    plt.title("Analysis: " + str(frame_number))
    plt.pie(sizes, labels=labels, colors=this_colors, shadow=True, startangle=140, autopct="%1.1f%%")

    plt.pause(0.01) 
开发者ID:OlafenwaMoses,项目名称:ImageAI,代码行数:35,代码来源:video_analysis_per_frame.py

示例15: showMaximize

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import get_current_fig_manager [as 别名]
def showMaximize():
    mng = plt.get_current_fig_manager()
    mng.window.state('zoomed')
    plt.show() 
开发者ID:tody411,项目名称:ColorHistogram,代码行数:6,代码来源:window.py


注:本文中的matplotlib.pyplot.get_current_fig_manager方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。