How to use the tellurium.getPlottingEngine function in tellurium

To help you get started, we’ve selected a few tellurium examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sys-bio / tellurium / tellurium / dev / oven / tesedml_testcase.py View on Github external
__var__task0_____time.shape += (1,)
plot_0_0_0 = __var__task0_____time

# DataGenerator 
__var__task0_____S1 = np.concatenate([process_trace(sim['[S1]']) for sim in task0])
if len(__var__task0_____S1.shape) == 1:
     __var__task0_____S1.shape += (1,)
plot_0_0_1 = __var__task0_____S1

# --------------------------------------------------------
# Outputs
# --------------------------------------------------------
# Output 
stacked=False
if not stacked:
    fig = te.getPlottingEngine().newFigure(title='plot_0')
else:
    fig = te.getPlottingEngine().newStackedFigure(title='plot_0')
if plot_0_0_0.shape[1] > 1:
    for k in range(plot_0_0_0.shape[1]):
        if k == 0:
            fig.addXYDataset(plot_0_0_0[:,k], plot_0_0_1[:,k], color='C0', tag='tag0', name='task0.S1')
        else:
            fig.addXYDataset(plot_0_0_0[:,k], plot_0_0_1[:,k], color='C0', tag='tag0')
else:
    for k in range(plot_0_0_0.shape[1]):
        if k == 0:
            fig.addXYDataset(plot_0_0_0[:,k], plot_0_0_1[:,k], color='C0', tag='tag0', name='task0.S1')
        else:
            fig.addXYDataset(plot_0_0_0[:,k], plot_0_0_1[:,k], color='C0', tag='tag0')
fig.render()
github sys-bio / tellurium / tellurium / dev / oven / tesedml_testcase.py View on Github external
# DataGenerator 
__var__task0_____S1 = np.concatenate([process_trace(sim['[S1]']) for sim in task0])
if len(__var__task0_____S1.shape) == 1:
     __var__task0_____S1.shape += (1,)
plot_0_0_1 = __var__task0_____S1

# --------------------------------------------------------
# Outputs
# --------------------------------------------------------
# Output 
stacked=False
if not stacked:
    fig = te.getPlottingEngine().newFigure(title='plot_0')
else:
    fig = te.getPlottingEngine().newStackedFigure(title='plot_0')
if plot_0_0_0.shape[1] > 1:
    for k in range(plot_0_0_0.shape[1]):
        if k == 0:
            fig.addXYDataset(plot_0_0_0[:,k], plot_0_0_1[:,k], color='C0', tag='tag0', name='task0.S1')
        else:
            fig.addXYDataset(plot_0_0_0[:,k], plot_0_0_1[:,k], color='C0', tag='tag0')
else:
    for k in range(plot_0_0_0.shape[1]):
        if k == 0:
            fig.addXYDataset(plot_0_0_0[:,k], plot_0_0_1[:,k], color='C0', tag='tag0', name='task0.S1')
        else:
            fig.addXYDataset(plot_0_0_0[:,k], plot_0_0_1[:,k], color='C0', tag='tag0')
fig.render()
github sys-bio / tellurium / tellurium / sedml / tesedml.py View on Github external
:return:
        :rtype:
        """
        self.inputStr = inputStr
        self.workingDir = workingDir
        self.python = sys.version
        self.platform = platform.platform()
        self.createOutputs = createOutputs
        self.saveOutputs = saveOutputs
        self.outputDir = outputDir
        self.plotFormat = "pdf"
        self.reportFormat = "csv"

        if not plottingEngine:
            plottingEngine = te.getPlottingEngine()
        self.plottingEngine = plottingEngine

        if self.outputDir:
            if not os.path.exists(outputDir):
                raise IOError("outputDir does not exist: {}".format(outputDir))


        info = SEDMLTools.readSEDMLDocument(inputStr, workingDir)
        self.doc = info['doc']
        self.inputType = info['inputType']
        self.workingDir = info['workingDir']

        # parse the models (resolve the source models & the applied changes for all models)
        model_sources, model_changes = SEDMLTools.resolveModelChanges(self.doc)
        self.model_sources = model_sources
        self.model_changes = model_changes
github sys-bio / tellurium / tellurium / plotting / api.py View on Github external
:param show: show=True (default) shows the plot, use show=False to plot multiple simulations in one plot
    :param showlegend: Whether to show the legend or not.
    :param mode: Can be set to 'markers' to generate scatter plots, or 'dash' for dashed lines.
    ::

        import numpy as np, tellurium as te
        result = np.array([[1,2,3,4], [7.2,6.5,8.8,10.5], [9.8, 6.5, 4.3,3.0]])
        te.plot(result[:,0], result[:,1], name='Second column', show=False)
        te.plot(result[:,0], result[:,2], name='Third column', show=False)
        te.show(reset=False) # does not reset the plot after showing plot
        te.plot(result[:,0], result[:,3], name='Fourth column', show=False)
        te.show()
    """
    from .. import getPlottingEngine
    # global _plot_index
    return getPlottingEngine().plot(x, y, show=show, **kwargs)
github sys-bio / tellurium / tellurium / plotting / api.py View on Github external
def show(reset=True):
    from .. import getPlottingEngine
    return getPlottingEngine().show(reset=reset)
github sys-bio / tellurium / tellurium / roadrunner / extended_roadrunner.py View on Github external
if tag:
            kwargs['tag'] = tag
        if labels:
            kwargs['labels'] = labels
        if figsize:
            kwargs['figsize'] = figsize
        if savefig:
            kwargs['savefig'] = savefig
        if dpi:
            kwargs['dpi'] = dpi
        if alpha:
            kwargs['alpha'] = alpha            

        # FIXME: provide the additional parameters to the plotting engine

        engine = getPlottingEngine()
        if show:
            # show the plot immediately
            engine.plotTimecourse(result, **kwargs)
        else:
            # otherwise, accumulate the traces
            engine.accumulateTimecourse(result, **kwargs)
github sys-bio / tellurium / tellurium / plotting / api.py View on Github external
def plot_text(x, y, text, show=True, **kwargs):
    from .. import getPlottingEngine
    from numpy import array
    if len(x.shape) < 1:
        x = array([x])
    if len(y.shape) < 1:
        y = array([y])
    if not isinstance(text, list):
        text = [text]
    return getPlottingEngine().plot_text(x, y, text=text, show=show, **kwargs)
github sys-bio / tellurium / tellurium / plotting / api.py View on Github external
def nextFigure(*args, **kwargs):
    from .. import getPlottingEngine
    if nextFigure.tiledFigure is not None:
        fig = nextFigure.tiledFigure.nextFigure(*args, **kwargs)
        #if nextFigure.tiledFigure.isExhausted():
            #nextFigure.tiledFigure = None
        return fig
    else:
        return getPlottingEngine().newFigure(*args, **kwargs)
nextFigure.tiledFigure = None
github sys-bio / tellurium / tellurium / plotting / api.py View on Github external
def newTiledFigure(*args, **kwargs):
    from .. import getPlottingEngine
    nextFigure.tiledFigure = getPlottingEngine().newTiledFigure(*args, **kwargs)
    return nextFigure.tiledFigure