当前位置: 首页>>代码示例>>Python>>正文


Python axislines.SubplotZero类代码示例

本文整理汇总了Python中mpl_toolkits.axes_grid.axislines.SubplotZero的典型用法代码示例。如果您正苦于以下问题:Python SubplotZero类的具体用法?Python SubplotZero怎么用?Python SubplotZero使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SubplotZero类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

    def run(self, results):
        par = self.getValueOfParameter("parameter")
        i = int(self.getValueOfParameter("iteration number"))
        title = self.getValueOfParameter("title")

        if(par==""):
            return False
        
        if(i >= results.__len__()):
            return False
        
        dialogform = Dialog(QApplication.activeWindow())
        fig = Figure((5.0, 4.0), dpi=100)
        ax = SubplotZero(fig, 1, 1, 1)
        fig.add_subplot(ax)

        for n in ["top", "right"]:
            ax.axis[n].set_visible(False)
            
        for n in ["bottom", "left"]:
            ax.axis[n].set_visible(True)
        
        x = results[i].getResults(par)   
        
        if(not(x.__len__())):
            return False
        
        ax.boxplot(x, notch=0, sym='+', vert=1, whis=1.5)
        
        ax.set_title(title)
        dialogform.showFigure(fig)
        return True
开发者ID:iut-ibk,项目名称:Calimero,代码行数:32,代码来源:libresulthandler.py

示例2: tell_winner

 def tell_winner(self, winner, *args):
     if self.show_text:
         print winner, "has won the game!"
     if not self.run_trials: return
     if self.graph:
         from mpl_toolkits.axes_grid.axislines import SubplotZero
         import matplotlib.pyplot as plt
         fig = plt.figure(1)
         ax = SubplotZero(fig, 111)
         fig.suptitle("Winrate of %s over time"%(self.stats.keys()[0]))
         fig.add_subplot(ax)
         ax.plot(self.stats.values()[0])
         plt.show()
     print self.stats.values()[0]
开发者ID:yawgmoth,项目名称:Dominion,代码行数:14,代码来源:buylist_player.py

示例3: make_zerocross_axes

def make_zerocross_axes(figsize, loc):
    fig = plt.figure(figsize=figsize)
    ax = SubplotZero(fig, loc)
    ax.set_aspect("equal")
    fig.add_subplot(ax)

    for direction in ["xzero", "yzero"]:
        axis = ax.axis[direction]
        axis.set_visible(True)

    for direction in ["left", "right", "bottom", "top"]:
        ax.axis[direction].set_visible(False)

    return ax
开发者ID:hejibo,项目名称:scpy2,代码行数:14,代码来源:zero_cross_axes.py

示例4: make_zerocross_axes

def make_zerocross_axes(figsize, loc):
    from matplotlib import pyplot as plt
    from mpl_toolkits.axes_grid.axislines import SubplotZero


    fig = plt.figure(figsize=figsize)
    ax = SubplotZero(fig, loc)
    ax.set_aspect("equal")
    fig.add_subplot(ax)

    for direction in ["xzero", "yzero"]:
        axis = ax.axis[direction]
        axis.set_visible(True)

    for direction in ["left", "right", "bottom", "top"]:
        ax.axis[direction].set_visible(False)

    return ax
开发者ID:Andor-Z,项目名称:scpy2,代码行数:18,代码来源:zero_cross_axes.py

示例5: plotAxis

    def plotAxis(self, matrix):
        #funct = gvbars(delta=0.05, color=color.blue)
        #for i in range(0, len(matrix[0])):
        #    funct.plot(pos=(0,matrix[0][i]))

        #pylab.scatter(3,4, s=100 ,marker='o', c=color.green)
        #pylab.show()

        fig = plt.figure(1)
        ax = SubplotZero(fig, 111)
        fig.add_subplot(ax)
        flattenMatrix = np.transpose(matrix).flatten()
        x = np.linspace(0., 10., len(flattenMatrix))
        print 'x ' + str(x)
        print 'matrix: ' + str(np.transpose(matrix).flatten())
        #ax.plot(x, np.sin(x*np.pi), linewidth=2.0)
        ax.plot(matrix, 0, linewidth=2.0)
        plt.show()
开发者ID:mtqp,项目名称:redes-neuronales-cammi-desousa,代码行数:18,代码来源:MatrixVisualizer.py

示例6: make_plot_ax

def make_plot_ax():
    fig = figure(figsize=(6, 5));
    ax = SubplotZero(fig, 111); fig.add_subplot(ax)
    for direction in ["xzero", "yzero"]:
        ax.axis[direction].set_axisline_style("-|>")
        ax.axis[direction].set_visible(True)
    for direction in ["left", "right", "bottom", "top"]:
        ax.axis[direction].set_visible(False)
    xlim(-0.1, 2.1); ylim(xlim())
    ticks = [0.5 * i for i in range(1, 5)]
    labels = [str(i) if i == int(i) else "" for i in ticks]
    ax.set_xticks(ticks); ax.set_yticks(ticks)
    ax.set_xticklabels(labels); ax.set_yticklabels(labels)
    ax.axis["yzero"].set_axis_direction("left")
    return ax
开发者ID:PaulPGauthier,项目名称:cobrapy,代码行数:15,代码来源:qp.py

示例7: graphWaveSamples

def graphWaveSamples(samples):
    y = [struct.unpack('h', i)[0] for i in samples]
    #print y
    print "max:", max(y)
    print "min:", min(y)
    print "avg:", sum(y)/float(len(y))
    fig = plt.figure(1)
    ax = SubplotZero(fig, 111)
    fig.add_subplot(ax)

    for direction in ["xzero", "yzero"]:
        ax.axis[direction].set_axisline_style("-|>")
        ax.axis[direction].set_visible(True)

    for direction in ["left", "right", "bottom", "top"]:
        ax.axis[direction].set_visible(False)


    x = range(len(y))
    ax.plot(x, y)

    plt.show()
开发者ID:capalmer1013,项目名称:natural-language,代码行数:22,代码来源:audioGen.py

示例8: _blank_plot

def _blank_plot(domain, ran):
    # make the plot
    fig = plt.figure(1)
    ax = SubplotZero(fig, 111)
    fig.add_subplot(ax)

    # thicken the axis lines
    ax.axhline(linewidth=1.7, color="k")
    ax.axvline(linewidth=1.7, color="k")

    x_lower, x_upper = int(domain.left), int(domain.right)  # needs to be changed, is just a temporary type changer
    y_lower, y_upper = int(ran.left), int(ran.right)

    # remove tick lines on the axes
    plt.xticks([])
    plt.yticks([])
    plt.ylim(y_lower, y_upper)
    plt.xlim(x_lower, x_upper)

    # add axes labels
    ax.text(1.05, 0, r'$x$', transform=BlendedGenericTransform(ax.transAxes, ax.transData), va='center')
    ax.text(0, 1.05, r'$y$', transform=BlendedGenericTransform(ax.transData, ax.transAxes), ha='center')

    # end-of-axis arrows
    x_width = (abs(plt.xlim()[0]) + abs(plt.xlim()[1]))
    y_width = (abs(plt.ylim()[0]) + abs(plt.ylim()[1]))
    plt.arrow(plt.xlim()[1], -0.003, 0.00000000001, 0,
              width=x_width*0.0015*0.5, color="k", clip_on=False,
              head_width=y_width*0.12/7, head_length=x_width*0.024*0.5)
    plt.arrow(0.003, plt.ylim()[1], 0, 0.00000000001,
              width=y_width*0.0015*0.5, color="k", clip_on=False,
              head_width=x_width*0.12/7, head_length=y_width*0.024*0.5)

    # only show cartesian axes
    for direction in ["xzero", "yzero"]:
        ax.axis[direction].set_visible(True)
    for direction in ["left", "right", "bottom", "top"]:
        ax.axis[direction].set_visible(False)
开发者ID:nebffa,项目名称:MathsExams,代码行数:38,代码来源:plot.py

示例9: SubplotZero

#!/usr/bin/python
print "content-type: text/html\n"
import cgi,cgitb
cgitb.enable()


from mpl_toolkits.axes_grid.axislines import SubplotZero
import matplotlib.pyplot as plt
import numpy as np

if 1:
    fig = plt.figure(1)
    ax = SubplotZero(fig, 111)
    fig.add_subplot(ax)

    for direction in ["xzero", "yzero"]:
        ax.axis[direction].set_axisline_style("-|>")
        ax.axis[direction].set_visible(True)

    for direction in ["left", "right", "bottom", "top"]:
        ax.axis[direction].set_visible(False)

    x = np.linspace(-0.5, 1., 100)
    ax.plot(x, np.sin(x*np.pi))

    plt.show()
开发者ID:czhangstuycs,项目名称:czhangstuycs.github.io,代码行数:26,代码来源:demo_axisline_style.py

示例10: main

def main(path, name):
  from numpy import linspace, loadtxt
  d = SimulatedData(path) 
  psth = d.spike_time.psth()
  
  from mpl_toolkits.axes_grid.axislines import SubplotZero
  import matplotlib.pyplot as plt
  
  f1 = plt.figure(figsize=[6,8])
  ax = SubplotZero(f1, 411)
  f1.add_subplot(ax)  
  psth.plot_raster(ax)
  
  ax = SubplotZero(f1, 412)
  f1.add_subplot(ax)
  psth.plot_rate(ax, smoothed=True)
  
  ax = SubplotZero(f1, 413)
  f1.add_subplot(ax)
  dat = loadtxt(d.path['ML response'])
  t = linspace(0, 5000, dat.size)
  ax.plot(t, dat, 'k')
  for direction in ["left", "right", "top", "bottom"]:
    ax.axis[direction].set_visible(False)
  logging.info(str(dir(ax.axis["bottom"])))
#  ax.axis["bottom"].major_ticklabels=[]
  ax.set_title("ML")
  
  ax = SubplotZero(f1, 414)
  f1.add_subplot(ax)
  dat = loadtxt(d.path['HHLS response'])
  t = linspace(0, 5000, dat.size)
  ax.plot(t, dat, 'k')
  for direction in ["left", "right", "top"]:
    ax.axis[direction].set_visible(False)
  ax.axis["bottom"].set_label("Time (ms)")
  ax.set_title("HHLS")
  
  f1.subplots_adjust(hspace=0.47, top=0.95, bottom=0.05)
  
  f2 = plt.figure(figsize=[4,4])
  ax = SubplotZero(f2, 111)
  f2.add_subplot(ax)
  mf = psth.hist_mean_rate(ax, bins=linspace(0,8,20))
  ax.set_title({"highvar": "High variance", "lowvar": "Low variance"}[name])
  print "Mean firing rate =", mf.mean(), "Hz", "(", mf.std(),")"
  plt.show()
开发者ID:shhong,项目名称:simple_two_layer_network,代码行数:47,代码来源:raster.py

示例11: Copyright

"""
Copyright (c) 2012 Michael Markieta
See the file license.txt for copying permission.
"""
from polar_grid import polar_grid
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid.axislines import SubplotZero

# Setup plotting for our polar grid
fig = plt.figure(1, figsize=(7,7))
ax = SubplotZero(fig, 111)
fig.add_subplot(ax)

# add axis lines for coordinate geometry (4 quadrants)
for direction in ["xzero", "yzero"]:
    ax.axis[direction].set_axisline_style("-|>", size=.75)
    ax.axis[direction].set_visible(True)

# remove axis lines/labels for rectangular geometry (-x and -y don't exist)
for direction in ["left", "right", "bottom", "top"]:
    ax.axis[direction].set_visible(False)

X = [] # hold x-coordinates from radial dividers
Y = [] # hold y-coordinates from radial dividers

# Generate geometry for a polar grid of 4-unit radius, centroid at (-2,1), with 8 divisions and precision of 4000 points
geom = polar_grid(rho=4, centroid=(-2,1), theta=8, tau=4000)

# Add coordinates from each radial divider to the X and Y lists
for num in range(0, len(geom)):
    for (x,y) in geom[num][1]:
开发者ID:MichaelMarkieta,项目名称:polar_grid,代码行数:31,代码来源:polar_grid_example.py

示例12: main

def main():
    f = open("game_output.txt", "r")
    l = json.load(f)
    min_time = 0
    for val in l:
        if min_time == 0:
            min_time = val["time"]
        if val["time"] < min_time:
            min_time = val["time"]
    max_time = 0
    for val in l:
        if max_time == 0:
            max_time = val["time"]
        if val["time"] > max_time:
            max_time = val["time"]

    print "%s %s" % (min_time, max_time)

    fig = plt.figure(1)
    fig.subplots_adjust(right=0.85)
    ax = SubplotZero(fig, 1, 1, 1)
    fig.add_subplot(ax)

    # make right and top axis invisible
    ax.axis["right"].set_visible(False)
    ax.axis["top"].set_visible(False)

    # make xzero axis (horizontal axis line through y=0) visible.
    ax.axis["xzero"].set_visible(False)
    #ax.axis["xzero"].label.set_text("Axis Zero")

    ax.set_xlim(min_time, max_time)
    ax.set_ylim(0, 4)
    ax.set_xlabel("Time")
    ax.set_ylabel("HRV")

    # make new (right-side) yaxis, but wth some offset
    # offset = (20, 0)
    # new_axisline = ax.get_grid_helper().new_fixed_axis

    # ax.axis["right2"] = new_axisline(loc="right",
    #                                  offset=offset,
    #                                  axes=ax)
    # ax.axis["right2"].label.set_text("Label Y2")

    #ax.plot([-2,3,2])
    t_hrv = []
    hrv = []
    for val in l:
        if "hrv" in val.keys():
            t_hrv.append(val["time"])
            hrv.append(val["hrv"])
            #ax.plot(val["time"], val["hrv"], 'b,')
        elif "key" in val.keys():
            ax.plot(val["time"], 2.0, 'r,')
    ax.plot(t_hrv, hrv, 'b-')

    hrv_dict = []
    for el in l:
        try:
            hrv_dict.append((el["time"], el["hrv"]))
        except KeyError:
            pass

    peak_dict = []

    current_peak = 0
    hrv_window = deque()
    hrv_limit = 20
    hrv_total = []
    stop_counter = 0
    hrv_itr = hrv_dict.__iter__()
    b = hrv_itr.next()

    while 1:
        a = [b[0], b[1], 0]
        hrv_window.append(a)
        hrv_total.append(a)
        if len(hrv_window) > hrv_limit:
            hrv_window.popleft()
        max_hrv = 0
        max_time = 0
        for h in hrv_window:
            if h[1] > max_hrv:
                max_time = h[0]
                max_hrv = h[1]
        for h in hrv_window:
            if h[0] == max_time:
                h[2] = h[2] + 1
                break
        try:
            c = hrv_itr.next()
            b = c
        except StopIteration:
            stop_counter = stop_counter + 1
            if stop_counter == hrv_limit:
                break
            
    pulse = 0
    for (time, hrv, score) in hrv_total:
#.........这里部分代码省略.........
开发者ID:qdot,项目名称:pulse-project,代码行数:101,代码来源:graph_example.py

示例13: f

def f(x, a):
    return a*x-x**2  # 包絡線の式を入れる
p = -3  # xの最小値
q = 3  # xの最大値
n = 12  # 引く包絡線の数
a_min = -10  # 表示させるaの最小値
a_max = 10  # 表示させるaの最大値
y_min = -6  # 表示させるbの最小値(最大値はa軸とb軸の縮尺が1:1になるよう自動で決まる)
# アスペクト比を定めただけだと異常に縦長なグラフが出てくるのでylimを定めた
y_max = y_min+a_max-a_min  # これは変数ではない
plt.figtext(0.85, 0.35, '$a$')  # 直接位置を指定しているので、グラフの位置を変えるときにこれも変える
plt.figtext(0.5, 0.95, '$b$')
# ここより上に変数が入る
fig = plt.figure(1)
ax = SubplotZero(fig, 111)
fig.add_subplot(ax)
ax.axhline(linewidth=1.0, color="black")
ax.axvline(linewidth=1.0, color="black")
ax.set_xticks([])  # 空のlistを指定することでticksが入らない
ax.set_yticks([])
ax.set(aspect=1)
for direction in ["xzero", "yzero"]:
    ax.axis[direction].set_axisline_style("-|>")
    ax.axis[direction].set_visible(True)
plt.ylim(ymin=y_min)  # この位置より前に置くとx方向が狭くなってしまった
plt.ylim(ymax=y_max)
a = linspace(a_min, a_max, (a_max-a_min) * 10)  # 点の数はaの動く範囲の長さ×10,これで曲線にも対応する
# linspaceの点の数に小数が来ることがあり得るのですが、その場合は勝手に小数点以下を切り捨てた数の点をとってくれるようです
for i in range(n):
    r = p+(q-p)*i/(n-1)  # n個の接線を引き2個は両端にあるので区間はn-1等分される
开发者ID:beeleb,项目名称:repository,代码行数:30,代码来源:newone.py

示例14: SubplotZero

# -*- coding: utf-8 -*-

import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.axes_grid.axislines import SubplotZero


# 図の背景の諸体裁を設定

# 作図スペースを用意(?)。個々のコードの意味がわかりません。	
fig = plt.figure(1)
ax = SubplotZero(fig, 111)
fig.add_subplot(ax)

# 軸の設定
ax.axhline(linewidth=1.2, color="black")
ax.axvline(linewidth=1.2, color="black")

# 軸に矢印
for direction in ["xzero", "yzero"]:
	ax.axis[direction].set_axisline_style("-|>")
	ax.axis[direction].set_visible(True)

# 四方のaxis(?)、spine(?)を消す	
for direction in ["left", "right", "bottom", "top"]:
	ax.axis[direction].set_visible(False)

# 軸に名前を付ける。位置は適宜設定。	
plt.figtext(0.93, 0.37, 'x')  
plt.figtext(0.505, 0.95, 'y')
开发者ID:yohanashima,项目名称:envelope,代码行数:30,代码来源:horakusen.py

示例15: renderGraph

    def renderGraph(self):  # pylint: disable=R0914
        assert len(self._oData.aoSeries) == 1
        oSeries = self._oData.aoSeries[0]

        # hacking
        # self.setWidth(512);
        # self.setHeight(128);
        # end

        oFigure = self._createFigure()
        from mpl_toolkits.axes_grid.axislines import SubplotZero

        # pylint: disable=E0401
        oAxis = SubplotZero(oFigure, 111)
        oFigure.add_subplot(oAxis)

        # Disable all the normal axis.
        oAxis.axis["right"].set_visible(False)
        oAxis.axis["top"].set_visible(False)
        oAxis.axis["bottom"].set_visible(False)
        oAxis.axis["left"].set_visible(False)

        # Use the zero axis instead.
        oAxis.axis["yzero"].set_axisline_style("-|>")
        oAxis.axis["yzero"].set_visible(True)
        oAxis.axis["xzero"].set_axisline_style("-|>")
        oAxis.axis["xzero"].set_visible(True)

        if oSeries.aoYValues[-1] == 100:
            sColor = "green"
        elif oSeries.aoYValues[-1] > 75:
            sColor = "yellow"
        else:
            sColor = "red"
        oAxis.plot(oSeries.aoXValues, oSeries.aoYValues, ".-", color=sColor, linewidth=3)
        oAxis.fill_between(oSeries.aoXValues, oSeries.aoYValues, facecolor=sColor, alpha=0.5)

        oAxis.set_xlim(left=-0.01)
        oAxis.set_xticklabels([])
        oAxis.set_xmargin(1)

        oAxis.set_ylim(bottom=0, top=100)
        oAxis.set_yticks([0, 50, 100])
        oAxis.set_ylabel("%")
        # oAxis.set_yticklabels([]);
        oAxis.set_yticklabels(["", "%", ""])

        return self._produceSvg(oFigure, False)
开发者ID:svn2github,项目名称:virtualbox,代码行数:48,代码来源:wuihlpgraphmatplotlib.py


注:本文中的mpl_toolkits.axes_grid.axislines.SubplotZero类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。