예제 #1
0
def plot(x, y, f, title, plt=None):
    if plt is None:
        # import matplotlib.pylab as plt
        import scitools.easyviz as plt
    plt.figure()
    plt.plot(x, y, x, f)
    plt.legend(["approximation", "exact"])
    plt.title(title)
    return plt
예제 #2
0
def plot(x, y, f, title, plt=None):
    if plt is None:
        #import matplotlib.pylab as plt
        import scitools.easyviz as plt
    plt.figure()
    plt.plot(x, y, x, f)
    plt.legend(["approximation", "exact"])
    plt.title(title)
    return plt
예제 #3
0
파일: tools.py 프로젝트: SpuqTeam/spuq
 def plotConvergence(cls, scale, error4scale, title, legend, regression = False):
     p.figure()
     p.loglog(scale, error4scale, "k-d", xlabel = "samples", ylabel = "error",)  # semilogy
     p.title(title)
     p.legend(legend)
     if regression and len(error4scale) > 1:
         p.hold('on')
         lineSpace = np.array((scale[0], scale[-1]))
         slope, intercept, r_value, p_value, std_err = stats.linregress(scale, np.log10(error4scale))
         line = np.power(10, slope * lineSpace + intercept)
         p.plot(lineSpace, line, "k:", legend = "{slope:.2}x + c" \
                .format(slope = slope))
     p.hardcopy(cls.folder + title + "  " + t.strftime('%Y-%m-%d_%H-%M') + ".pdf")