Python matplotlib.verbose() Examples

The following are 19 code examples for showing how to use matplotlib.verbose(). These examples are extracted from open source projects. 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 check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module matplotlib , or try the search function .

Example 1
Project: Computable   Author: ktraunmueller   File: font_manager.py    License: MIT License 5 votes vote down vote up
def _rebuild():
        global fontManager
        fontManager = FontManager()
        if _fmcache:
            pickle_dump(fontManager, _fmcache)
        verbose.report("generated new fontManager") 
Example 2
Project: Computable   Author: ktraunmueller   File: backend_tkagg.py    License: MIT License 5 votes vote down vote up
def new_figure_manager_given_figure(num, figure):
    """
    Create a new figure manager instance for the given figure.
    """
    _focus = windowing.FocusManager()
    window = Tk.Tk()
    window.withdraw()

    if Tk.TkVersion >= 8.5:
        # put a mpl icon on the window rather than the default tk icon. Tkinter
        # doesn't allow colour icons on linux systems, but tk >=8.5 has a iconphoto
        # command which we call directly. Source:
        # http://mail.python.org/pipermail/tkinter-discuss/2006-November/000954.html
        icon_fname = os.path.join(rcParams['datapath'], 'images', 'matplotlib.gif')
        icon_img = Tk.PhotoImage(file=icon_fname)
        try:
            window.tk.call('wm', 'iconphoto', window._w, icon_img)
        except (SystemExit, KeyboardInterrupt):
            # re-raise exit type Exceptions
            raise
        except:
            # log the failure, but carry on
            verbose.report('Could not load matplotlib icon: %s' % sys.exc_info()[1])

    canvas = FigureCanvasTkAgg(figure, master=window)
    figManager = FigureManagerTkAgg(canvas, num, window)
    if matplotlib.is_interactive():
        figManager.show()
    return figManager 
Example 3
Project: matplotlib-4-abaqus   Author: Solid-Mechanics   File: font_manager.py    License: MIT License 5 votes vote down vote up
def _rebuild():
        global fontManager
        fontManager = FontManager()
        if _fmcache:
            pickle_dump(fontManager, _fmcache)
        verbose.report("generated new fontManager") 
Example 4
Project: matplotlib-4-abaqus   Author: Solid-Mechanics   File: backend_tkagg.py    License: MIT License 5 votes vote down vote up
def new_figure_manager_given_figure(num, figure):
    """
    Create a new figure manager instance for the given figure.
    """
    _focus = windowing.FocusManager()
    window = Tk.Tk()
    window.withdraw()

    if Tk.TkVersion >= 8.5:
        # put a mpl icon on the window rather than the default tk icon. Tkinter
        # doesn't allow colour icons on linux systems, but tk >=8.5 has a iconphoto
        # command which we call directly. Source:
        # http://mail.python.org/pipermail/tkinter-discuss/2006-November/000954.html
        icon_fname = os.path.join(rcParams['datapath'], 'images', 'matplotlib.gif')
        icon_img = Tk.PhotoImage(file=icon_fname)
        try:
            window.tk.call('wm', 'iconphoto', window._w, icon_img)
        except (SystemExit, KeyboardInterrupt):
            # re-raise exit type Exceptions
            raise
        except:
            # log the failure, but carry on
            verbose.report('Could not load matplotlib icon: %s' % sys.exc_info()[1])

    canvas = FigureCanvasTkAgg(figure, master=window)
    figManager = FigureManagerTkAgg(canvas, num, window)
    if matplotlib.is_interactive():
        figManager.show()
    return figManager 
Example 5
Project: neural-network-animation   Author: miloharper   File: font_manager.py    License: MIT License 5 votes vote down vote up
def _rebuild():
        global fontManager
        fontManager = FontManager()
        if _fmcache:
            pickle_dump(fontManager, _fmcache)
        verbose.report("generated new fontManager") 
Example 6
Project: neural-network-animation   Author: miloharper   File: backend_tkagg.py    License: MIT License 5 votes vote down vote up
def new_figure_manager_given_figure(num, figure):
    """
    Create a new figure manager instance for the given figure.
    """
    _focus = windowing.FocusManager()
    window = Tk.Tk()
    window.withdraw()

    if Tk.TkVersion >= 8.5:
        # put a mpl icon on the window rather than the default tk icon. Tkinter
        # doesn't allow colour icons on linux systems, but tk >=8.5 has a iconphoto
        # command which we call directly. Source:
        # http://mail.python.org/pipermail/tkinter-discuss/2006-November/000954.html
        icon_fname = os.path.join(rcParams['datapath'], 'images', 'matplotlib.gif')
        icon_img = Tk.PhotoImage(file=icon_fname)
        try:
            window.tk.call('wm', 'iconphoto', window._w, icon_img)
        except (SystemExit, KeyboardInterrupt):
            # re-raise exit type Exceptions
            raise
        except:
            # log the failure, but carry on
            verbose.report('Could not load matplotlib icon: %s' % sys.exc_info()[1])

    canvas = FigureCanvasTkAgg(figure, master=window)
    figManager = FigureManagerTkAgg(canvas, num, window)
    if matplotlib.is_interactive():
        figManager.show()
    return figManager 
Example 7
Project: python3_ios   Author: holzschu   File: test_basic.py    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_verbose():
    assert isinstance(matplotlib.verbose, matplotlib.Verbose) 
Example 8
Project: ImageFusion   Author: pfchai   File: font_manager.py    License: MIT License 5 votes vote down vote up
def _rebuild():
        global fontManager
        fontManager = FontManager()
        if _fmcache:
            pickle_dump(fontManager, _fmcache)
        verbose.report("generated new fontManager") 
Example 9
Project: ImageFusion   Author: pfchai   File: backend_tkagg.py    License: MIT License 5 votes vote down vote up
def new_figure_manager_given_figure(num, figure):
    """
    Create a new figure manager instance for the given figure.
    """
    _focus = windowing.FocusManager()
    window = Tk.Tk()
    window.withdraw()

    if Tk.TkVersion >= 8.5:
        # put a mpl icon on the window rather than the default tk icon. Tkinter
        # doesn't allow colour icons on linux systems, but tk >=8.5 has a iconphoto
        # command which we call directly. Source:
        # http://mail.python.org/pipermail/tkinter-discuss/2006-November/000954.html
        icon_fname = os.path.join(rcParams['datapath'], 'images', 'matplotlib.gif')
        icon_img = Tk.PhotoImage(file=icon_fname)
        try:
            window.tk.call('wm', 'iconphoto', window._w, icon_img)
        except (SystemExit, KeyboardInterrupt):
            # re-raise exit type Exceptions
            raise
        except:
            # log the failure, but carry on
            verbose.report('Could not load matplotlib icon: %s' % sys.exc_info()[1])

    canvas = FigureCanvasTkAgg(figure, master=window)
    figManager = FigureManagerTkAgg(canvas, num, window)
    if matplotlib.is_interactive():
        figManager.show()
    return figManager 
Example 10
Project: coffeegrindsize   Author: jgagneastro   File: test_basic.py    License: MIT License 5 votes vote down vote up
def test_verbose():
    assert isinstance(matplotlib.verbose, matplotlib.Verbose) 
Example 11
Project: twitter-stock-recommendation   Author: alvarobartt   File: test_basic.py    License: MIT License 5 votes vote down vote up
def test_verbose():
    assert isinstance(matplotlib.verbose, matplotlib.Verbose) 
Example 12
Project: Computable   Author: ktraunmueller   File: font_manager.py    License: MIT License 4 votes vote down vote up
def createFontList(fontfiles, fontext='ttf'):
    """
    A function to create a font lookup list.  The default is to create
    a list of TrueType fonts.  An AFM font list can optionally be
    created.
    """

    fontlist = []
    #  Add fonts from list of known font files.
    seen = {}
    for fpath in fontfiles:
        verbose.report('createFontDict: %s' % (fpath), 'debug')
        fname = os.path.split(fpath)[1]
        if fname in seen:  continue
        else: seen[fname] = 1
        if fontext == 'afm':
            try:
                fh = open(fpath, 'rb')
            except:
                verbose.report("Could not open font file %s" % fpath)
                continue
            try:
                try:
                    font = afm.AFM(fh)
                finally:
                    fh.close()
            except RuntimeError:
                verbose.report("Could not parse font file %s"%fpath)
                continue
            try:
                prop = afmFontProperty(fpath, font)
            except KeyError:
                continue
        else:
            try:
                font = ft2font.FT2Font(str(fpath))
            except RuntimeError:
                verbose.report("Could not open font file %s"%fpath)
                continue
            except UnicodeError:
                verbose.report("Cannot handle unicode filenames")
                #print >> sys.stderr, 'Bad file is', fpath
                continue
            try:
                prop = ttfFontProperty(font)
            except KeyError:
                continue

        fontlist.append(prop)
    return fontlist 
Example 13
Project: Computable   Author: ktraunmueller   File: font_manager.py    License: MIT License 4 votes vote down vote up
def __init__(self, size=None, weight='normal'):
        self._version = self.__version__

        self.__default_weight = weight
        self.default_size = size

        paths = [os.path.join(rcParams['datapath'], 'fonts', 'ttf'),
                 os.path.join(rcParams['datapath'], 'fonts', 'afm'),
                 os.path.join(rcParams['datapath'], 'fonts', 'pdfcorefonts')]

        #  Create list of font paths
        for pathname in ['TTFPATH', 'AFMPATH']:
            if pathname in os.environ:
                ttfpath = os.environ[pathname]
                if ttfpath.find(';') >= 0: #win32 style
                    paths.extend(ttfpath.split(';'))
                elif ttfpath.find(':') >= 0: # unix style
                    paths.extend(ttfpath.split(':'))
                else:
                    paths.append(ttfpath)

        verbose.report('font search path %s'%(str(paths)))
        #  Load TrueType fonts and create font dictionary.

        #self.ttffiles = findSystemFonts(paths) + findSystemFonts()
        self.ttffiles = findSystemFonts(paths)
        self.defaultFamily = {
            'ttf': 'Bitstream Vera Sans',
            'afm': 'Helvetica'}
        self.defaultFont = {}

        for fname in self.ttffiles:
            verbose.report('trying fontname %s' % fname, 'debug')
            if fname.lower().find('vera.ttf')>=0:
                self.defaultFont['ttf'] = fname
                break
        else:
            # use anything
            self.defaultFont['ttf'] = self.ttffiles[0]

        self.ttflist = createFontList(self.ttffiles)

        self.afmfiles = findSystemFonts(paths, fontext='afm') + \
            findSystemFonts(fontext='afm')
        self.afmlist = createFontList(self.afmfiles, fontext='afm')
        if len(self.afmfiles):
            self.defaultFont['afm'] = self.afmfiles[0]
        else:
            self.defaultFont['afm'] = None

        self.ttf_lookup_cache = {}
        self.afm_lookup_cache = {} 
Example 14
Project: matplotlib-4-abaqus   Author: Solid-Mechanics   File: font_manager.py    License: MIT License 4 votes vote down vote up
def createFontList(fontfiles, fontext='ttf'):
    """
    A function to create a font lookup list.  The default is to create
    a list of TrueType fonts.  An AFM font list can optionally be
    created.
    """

    fontlist = []
    #  Add fonts from list of known font files.
    seen = {}
    for fpath in fontfiles:
        verbose.report('createFontDict: %s' % (fpath), 'debug')
        fname = os.path.split(fpath)[1]
        if fname in seen:  continue
        else: seen[fname] = 1
        if fontext == 'afm':
            try:
                fh = open(fpath, 'rb')
            except:
                verbose.report("Could not open font file %s" % fpath)
                continue
            try:
                try:
                    font = afm.AFM(fh)
                finally:
                    fh.close()
            except RuntimeError:
                verbose.report("Could not parse font file %s"%fpath)
                continue
            try:
                prop = afmFontProperty(fpath, font)
            except KeyError:
                continue
        else:
            try:
                font = ft2font.FT2Font(str(fpath))
            except RuntimeError:
                verbose.report("Could not open font file %s"%fpath)
                continue
            except UnicodeError:
                verbose.report("Cannot handle unicode filenames")
                #print >> sys.stderr, 'Bad file is', fpath
                continue
            try:
                prop = ttfFontProperty(font)
            except KeyError:
                continue

        fontlist.append(prop)
    return fontlist 
Example 15
Project: matplotlib-4-abaqus   Author: Solid-Mechanics   File: font_manager.py    License: MIT License 4 votes vote down vote up
def __init__(self, size=None, weight='normal'):
        self._version = self.__version__

        self.__default_weight = weight
        self.default_size = size

        paths = [os.path.join(rcParams['datapath'], 'fonts', 'ttf'),
                 os.path.join(rcParams['datapath'], 'fonts', 'afm'),
                 os.path.join(rcParams['datapath'], 'fonts', 'pdfcorefonts')]

        #  Create list of font paths
        for pathname in ['TTFPATH', 'AFMPATH']:
            if pathname in os.environ:
                ttfpath = os.environ[pathname]
                if ttfpath.find(';') >= 0: #win32 style
                    paths.extend(ttfpath.split(';'))
                elif ttfpath.find(':') >= 0: # unix style
                    paths.extend(ttfpath.split(':'))
                else:
                    paths.append(ttfpath)

        verbose.report('font search path %s'%(str(paths)))
        #  Load TrueType fonts and create font dictionary.

        self.ttffiles = findSystemFonts(paths) + findSystemFonts()
        self.defaultFamily = {
            'ttf': 'Bitstream Vera Sans',
            'afm': 'Helvetica'}
        self.defaultFont = {}

        for fname in self.ttffiles:
            verbose.report('trying fontname %s' % fname, 'debug')
            if fname.lower().find('vera.ttf')>=0:
                self.defaultFont['ttf'] = fname
                break
        else:
            # use anything
            self.defaultFont['ttf'] = self.ttffiles[0]

        self.ttflist = createFontList(self.ttffiles)

        self.afmfiles = findSystemFonts(paths, fontext='afm') + \
            findSystemFonts(fontext='afm')
        self.afmlist = createFontList(self.afmfiles, fontext='afm')
        if len(self.afmfiles):
            self.defaultFont['afm'] = self.afmfiles[0]
        else:
            self.defaultFont['afm'] = None

        self.ttf_lookup_cache = {}
        self.afm_lookup_cache = {} 
Example 16
Project: neural-network-animation   Author: miloharper   File: font_manager.py    License: MIT License 4 votes vote down vote up
def createFontList(fontfiles, fontext='ttf'):
    """
    A function to create a font lookup list.  The default is to create
    a list of TrueType fonts.  An AFM font list can optionally be
    created.
    """

    fontlist = []
    #  Add fonts from list of known font files.
    seen = {}
    for fpath in fontfiles:
        verbose.report('createFontDict: %s' % (fpath), 'debug')
        fname = os.path.split(fpath)[1]
        if fname in seen:  continue
        else: seen[fname] = 1
        if fontext == 'afm':
            try:
                fh = open(fpath, 'rb')
            except:
                verbose.report("Could not open font file %s" % fpath)
                continue
            try:
                try:
                    font = afm.AFM(fh)
                finally:
                    fh.close()
            except RuntimeError:
                verbose.report("Could not parse font file %s"%fpath)
                continue
            try:
                prop = afmFontProperty(fpath, font)
            except KeyError:
                continue
        else:
            try:
                font = ft2font.FT2Font(fpath)
            except RuntimeError:
                verbose.report("Could not open font file %s"%fpath)
                continue
            except UnicodeError:
                verbose.report("Cannot handle unicode filenames")
                #print >> sys.stderr, 'Bad file is', fpath
                continue
            try:
                prop = ttfFontProperty(font)
            except KeyError:
                continue

        fontlist.append(prop)
    return fontlist 
Example 17
Project: neural-network-animation   Author: miloharper   File: font_manager.py    License: MIT License 4 votes vote down vote up
def __init__(self, size=None, weight='normal'):
        self._version = self.__version__

        self.__default_weight = weight
        self.default_size = size

        paths = [os.path.join(rcParams['datapath'], 'fonts', 'ttf'),
                 os.path.join(rcParams['datapath'], 'fonts', 'afm'),
                 os.path.join(rcParams['datapath'], 'fonts', 'pdfcorefonts')]

        #  Create list of font paths
        for pathname in ['TTFPATH', 'AFMPATH']:
            if pathname in os.environ:
                ttfpath = os.environ[pathname]
                if ttfpath.find(';') >= 0: #win32 style
                    paths.extend(ttfpath.split(';'))
                elif ttfpath.find(':') >= 0: # unix style
                    paths.extend(ttfpath.split(':'))
                else:
                    paths.append(ttfpath)

        verbose.report('font search path %s'%(str(paths)))
        #  Load TrueType fonts and create font dictionary.

        self.ttffiles = findSystemFonts(paths) + findSystemFonts()
        self.defaultFamily = {
            'ttf': 'Bitstream Vera Sans',
            'afm': 'Helvetica'}
        self.defaultFont = {}

        for fname in self.ttffiles:
            verbose.report('trying fontname %s' % fname, 'debug')
            if fname.lower().find('vera.ttf')>=0:
                self.defaultFont['ttf'] = fname
                break
        else:
            # use anything
            self.defaultFont['ttf'] = self.ttffiles[0]

        self.ttflist = createFontList(self.ttffiles)

        self.afmfiles = findSystemFonts(paths, fontext='afm') + \
            findSystemFonts(fontext='afm')
        self.afmlist = createFontList(self.afmfiles, fontext='afm')
        if len(self.afmfiles):
            self.defaultFont['afm'] = self.afmfiles[0]
        else:
            self.defaultFont['afm'] = None 
Example 18
Project: ImageFusion   Author: pfchai   File: font_manager.py    License: MIT License 4 votes vote down vote up
def createFontList(fontfiles, fontext='ttf'):
    """
    A function to create a font lookup list.  The default is to create
    a list of TrueType fonts.  An AFM font list can optionally be
    created.
    """

    fontlist = []
    #  Add fonts from list of known font files.
    seen = {}
    for fpath in fontfiles:
        verbose.report('createFontDict: %s' % (fpath), 'debug')
        fname = os.path.split(fpath)[1]
        if fname in seen:  continue
        else: seen[fname] = 1
        if fontext == 'afm':
            try:
                fh = open(fpath, 'rb')
            except:
                verbose.report("Could not open font file %s" % fpath)
                continue
            try:
                try:
                    font = afm.AFM(fh)
                finally:
                    fh.close()
            except RuntimeError:
                verbose.report("Could not parse font file %s"%fpath)
                continue
            try:
                prop = afmFontProperty(fpath, font)
            except KeyError:
                continue
        else:
            try:
                font = ft2font.FT2Font(fpath)
            except RuntimeError:
                verbose.report("Could not open font file %s"%fpath)
                continue
            except UnicodeError:
                verbose.report("Cannot handle unicode filenames")
                #print >> sys.stderr, 'Bad file is', fpath
                continue
            try:
                prop = ttfFontProperty(font)
            except KeyError:
                continue

        fontlist.append(prop)
    return fontlist 
Example 19
Project: ImageFusion   Author: pfchai   File: font_manager.py    License: MIT License 4 votes vote down vote up
def __init__(self, size=None, weight='normal'):
        self._version = self.__version__

        self.__default_weight = weight
        self.default_size = size

        paths = [os.path.join(rcParams['datapath'], 'fonts', 'ttf'),
                 os.path.join(rcParams['datapath'], 'fonts', 'afm'),
                 os.path.join(rcParams['datapath'], 'fonts', 'pdfcorefonts')]

        #  Create list of font paths
        for pathname in ['TTFPATH', 'AFMPATH']:
            if pathname in os.environ:
                ttfpath = os.environ[pathname]
                if ttfpath.find(';') >= 0: #win32 style
                    paths.extend(ttfpath.split(';'))
                elif ttfpath.find(':') >= 0: # unix style
                    paths.extend(ttfpath.split(':'))
                else:
                    paths.append(ttfpath)

        verbose.report('font search path %s'%(str(paths)))
        #  Load TrueType fonts and create font dictionary.

        self.ttffiles = findSystemFonts(paths) + findSystemFonts()
        self.defaultFamily = {
            'ttf': 'Bitstream Vera Sans',
            'afm': 'Helvetica'}
        self.defaultFont = {}

        for fname in self.ttffiles:
            verbose.report('trying fontname %s' % fname, 'debug')
            if fname.lower().find('vera.ttf')>=0:
                self.defaultFont['ttf'] = fname
                break
        else:
            # use anything
            self.defaultFont['ttf'] = self.ttffiles[0]

        self.ttflist = createFontList(self.ttffiles)

        self.afmfiles = findSystemFonts(paths, fontext='afm') + \
            findSystemFonts(fontext='afm')
        self.afmlist = createFontList(self.afmfiles, fontext='afm')
        if len(self.afmfiles):
            self.defaultFont['afm'] = self.afmfiles[0]
        else:
            self.defaultFont['afm'] = None