Package PyFoam :: Package Basics :: Module PlotTimelinesFactory
[hide private]
[frames] | no frames]

Source Code for Module PyFoam.Basics.PlotTimelinesFactory

 1  #  ICE Revision: $Id: PlotTimelinesFactory.py 10884 2009-09-23 08:11:01Z bgschaid $  
 2  """Creates subclasses of GeneralPlotTimelines""" 
 3   
 4  from GnuplotTimelines import GnuplotTimelines 
 5  from MatplotlibTimelines import MatplotlibTimelines 
 6  from DummyPlotTimelines import DummyPlotTimelines 
 7   
 8  from CustomPlotInfo import CustomPlotInfo 
 9   
10   
11  from PyFoam import configuration 
12  from PyFoam.Error import error 
13   
14  lookupTable = { "gnuplot" : GnuplotTimelines , 
15                  "matplotlib" : MatplotlibTimelines, 
16                  "dummy" : DummyPlotTimelines  } 
17   
18 -def createPlotTimelines(timelines,custom,implementation=None):
19 """Creates a plotting object 20 @param timelines: The timelines object 21 @type timelines: TimeLineCollection 22 @param custom: specifies how the block should look like 23 @param implementation: the implementation that should be used 24 """ 25 if implementation==None: 26 implementation=configuration().get("Plotting","preferredImplementation") 27 28 if implementation not in lookupTable: 29 error("Requested plotting implementation",implementation, 30 "not in list of available implementations",lookupTable.keys()) 31 32 return lookupTable[implementation](timelines,custom)
33
34 -def createPlotTimelinesDirect(name, 35 timelines, 36 persist=None, 37 raiseit=True, 38 with_="lines", 39 alternateAxis=[], 40 forbidden=[], 41 start=None, 42 end=None, 43 logscale=False, 44 ylabel=None, 45 y2label=None, 46 implementation=None):
47 """Creates a plot using some prefefined values 48 @param timelines: The timelines object 49 @type timelines: TimeLineCollection 50 @param persist: Gnuplot window persistst after run 51 @param raiseit: Raise the window at every plot 52 @param with_: how to plot the data (lines, points, steps) 53 @param alternateAxis: list with names that ought to appear on the alternate y-axis 54 @param forbidden: A list with strings. If one of those strings is found in a name, it is not plotted 55 @param start: First time that should be plotted. If undefined everything from the start is plotted 56 @param end: Last time that should be plotted. If undefined data is plotted indefinitly 57 @param logscale: Scale the y-axis logarithmic 58 @param ylabel: Label of the y-axis 59 @param y2label: Label of the alternate y-axis 60 @param implementation: the implementation that should be used 61 """ 62 63 ci=CustomPlotInfo(name=name) 64 ci.persist=persist 65 ci.raiseit=raiseit 66 ci.with_=with_ 67 ci.alternateAxis=alternateAxis 68 ci.forbidden=forbidden 69 ci.start=start 70 ci.end=end 71 ci.logscale=logscale 72 ci.ylabel=ylabel 73 ci.y2label=y2label 74 75 return createPlotTimelines(timelines,ci,implementation=implementation)
76