CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Functions | Variables
python.rootplot.root2matplotlib Namespace Reference

Classes

class  Hist
 
class  Hist2D
 Define classes. More...
 
class  HistStack
 
class  RootFile
 

Functions

def replace
 

Variables

string __license__
 
tuple _all_whitespace_string = re.compile(r'\s*$')
 Define constants. More...
 

Detailed Description

Utilities for plotting ROOT histograms in matplotlib.

Function Documentation

def python.rootplot.root2matplotlib.replace (   string,
  replacements 
)
Modify a string based on a list of patterns and substitutions.

replacements should be a list of two-entry tuples, the first entry giving
a string to search for and the second entry giving the string with which
to replace it.  If replacements includes a pattern entry containing
'use_regexp', then all patterns will be treated as regular expressions
using re.sub.

Definition at line 417 of file root2matplotlib.py.

Referenced by python.rootplot.root2matplotlib.Hist.bar(), python.rootplot.root2matplotlib.Hist.barh(), python.rootplot.root2matplotlib.Hist.errorbar(), python.rootplot.root2matplotlib.Hist.errorbarh(), and python.rootplot.root2matplotlib.Hist.show_titles().

418 def replace(string, replacements):
419  """
420  Modify a string based on a list of patterns and substitutions.
421 
422  replacements should be a list of two-entry tuples, the first entry giving
423  a string to search for and the second entry giving the string with which
424  to replace it. If replacements includes a pattern entry containing
425  'use_regexp', then all patterns will be treated as regular expressions
426  using re.sub.
427  """
428  if not replacements:
429  return string
430  if 'use_regexp' in [x for x,y in replacements]:
431  for pattern, repl in [x for x in replacements
432  if x[0] != 'use_regexp']:
433  string = re.sub(pattern, repl, string)
434  else:
435  for pattern, repl in replacements:
436  string = string.replace(pattern, repl)
437  if re.match(_all_whitespace_string, string):
438  return ""
439  return string
440 

Variable Documentation

string python.rootplot.root2matplotlib.__license__
Initial value:
1 = '''\
2 Copyright (c) 2009-2010 Jeff Klukas <klukas@wisc.edu>
3 
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10 
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
13 
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 THE SOFTWARE.
21 '''

Definition at line 5 of file root2matplotlib.py.

tuple python.rootplot.root2matplotlib._all_whitespace_string = re.compile(r'\s*$')

Define constants.

Definition at line 42 of file root2matplotlib.py.