コード例 #1
0
# # Now add the legend with some customizations.
# legend = ax.legend(loc='upper center', shadow=True)

# # The frame is matplotlib.patches.Rectangle instance surrounding the legend.
# frame  = legend.get_frame()
# frame.set_facecolor('0.90')

# # Set the fontsize
# for label in legend.get_texts():
#     label.set_fontsize('large')

# for label in legend.get_lines():
#     label.set_linewidth(1.5)  # the legend line width
# plt.show()
import xogeny.locales as xlocales
_ = xlocales.create_gettext('plot_utils')


def render_twoup_plot(name, spec1, spec2):
    pass


def render_comp_plot(name1, vars1, name2, vars2, title, legloc, ylabel):
    import matplotlib.pyplot as plt
    import math
    xlocales.set_matplotlib()

    if len(vars1) != len(vars2):
        raise BaseException("Mismatch in variable arrays, %d vs %s" %
                            (len(vars1), len(vars2)))
コード例 #2
0
import os
import sys

sys.path.append(os.path.join(".", "source", "_sphinxext"))


from xogeny.gen_utils import *
from xogeny.locales import create_gettext
_ = create_gettext('specs')

## Simple Examples
fovars = [Var("x", legend=_("x"))]
add_case(["SimpleExample", "FirstOrder$"], res="FO", stopTime=10);
add_simple_plot(plot="FO", vars=fovars, title=_("Simulation of FirstOrder"))

focvars = [Var("x", legend=_("x (FirstOrder)"))]
foivars = [Var("x", legend=_("x (FirstOrderInitial)"))]
add_case(["SimpleExample", "FirstOrderInitial"], stopTime=10, res="FOI")
add_compare_plot(plot="FOI",
                 res1="FOI", v1=foivars,
                 res2="FO", v2=focvars,
                 title=_("Specifying (non-zero) Initial Conditions"))

add_case(["SimpleExample", "FirstOrderExperiment"], res="FOE")
add_simple_plot(plot="FOE", vars=fovars, title=_("Simulation Using Experiment Annotation"))

fosvars = [Var("x", legend=_("x (FirstOrderSteady)"))]
add_case(["SimpleExample", "FirstOrderSteady"], stopTime=10, res="FOS")
add_compare_plot(plot="FOS",
                 res1="FOS", v1=fosvars,
                 res2="FO", v2=focvars,
コード例 #3
0
ファイル: plot_utils.py プロジェクト: dietmarw/ModelicaBook
# # Now add the legend with some customizations.
# legend = ax.legend(loc='upper center', shadow=True)

# # The frame is matplotlib.patches.Rectangle instance surrounding the legend.
# frame  = legend.get_frame()
# frame.set_facecolor('0.90')

# # Set the fontsize
# for label in legend.get_texts():
#     label.set_fontsize('large')

# for label in legend.get_lines():
#     label.set_linewidth(1.5)  # the legend line width
# plt.show()
import xogeny.locales as xlocales
_ = xlocales.create_gettext('plot_utils')

def render_twoup_plot(name, spec1, spec2):
    pass

def render_comp_plot(name1, vars1, name2, vars2, title, legloc, ylabel):
    import matplotlib.pyplot as plt
    import math
    xlocales.set_matplotlib()

    if len(vars1)!=len(vars2):
        raise BaseException("Mismatch in variable arrays, %d vs %s" % (len(vars1), len(vars2)))

    # Location of results (relative to extention directory)
    resdir = os.path.abspath(os.path.join(os.path.dirname(__file__),
                                          "..", "..", "..", "results"))