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

Source Code for Module PyFoam.Basics.PlotTimelinesFactory

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