Python matplotlib.verbose() Examples
The following are 19
code examples of matplotlib.verbose().
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
, or try the search function
.
Example #1
Source File: test_basic.py From twitter-stock-recommendation with MIT License | 5 votes |
def test_verbose(): assert isinstance(matplotlib.verbose, matplotlib.Verbose)
Example #2
Source File: font_manager.py From Computable with MIT License | 5 votes |
def _rebuild(): global fontManager fontManager = FontManager() if _fmcache: pickle_dump(fontManager, _fmcache) verbose.report("generated new fontManager")
Example #3
Source File: backend_tkagg.py From Computable with MIT License | 5 votes |
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 #4
Source File: test_basic.py From coffeegrindsize with MIT License | 5 votes |
def test_verbose(): assert isinstance(matplotlib.verbose, matplotlib.Verbose)
Example #5
Source File: backend_tkagg.py From ImageFusion with MIT License | 5 votes |
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 #6
Source File: font_manager.py From matplotlib-4-abaqus with MIT License | 5 votes |
def _rebuild(): global fontManager fontManager = FontManager() if _fmcache: pickle_dump(fontManager, _fmcache) verbose.report("generated new fontManager")
Example #7
Source File: backend_tkagg.py From matplotlib-4-abaqus with MIT License | 5 votes |
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 #8
Source File: font_manager.py From ImageFusion with MIT License | 5 votes |
def _rebuild(): global fontManager fontManager = FontManager() if _fmcache: pickle_dump(fontManager, _fmcache) verbose.report("generated new fontManager")
Example #9
Source File: font_manager.py From neural-network-animation with MIT License | 5 votes |
def _rebuild(): global fontManager fontManager = FontManager() if _fmcache: pickle_dump(fontManager, _fmcache) verbose.report("generated new fontManager")
Example #10
Source File: backend_tkagg.py From neural-network-animation with MIT License | 5 votes |
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 #11
Source File: test_basic.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_verbose(): assert isinstance(matplotlib.verbose, matplotlib.Verbose)
Example #12
Source File: font_manager.py From neural-network-animation with MIT License | 4 votes |
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 #13
Source File: font_manager.py From ImageFusion with MIT License | 4 votes |
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 #14
Source File: font_manager.py From ImageFusion with MIT License | 4 votes |
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 #15
Source File: font_manager.py From Computable with MIT License | 4 votes |
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 #16
Source File: font_manager.py From neural-network-animation with MIT License | 4 votes |
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
Source File: font_manager.py From matplotlib-4-abaqus with MIT License | 4 votes |
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 #18
Source File: font_manager.py From matplotlib-4-abaqus with MIT License | 4 votes |
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 #19
Source File: font_manager.py From Computable with MIT License | 4 votes |
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 = {}